« first day (4933 days earlier)   

12:27 AM
@ParkingMaster Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. See the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
 
James, you're supposed to run it :/
 
 
3 hours later…
3:08 AM
 
 
2 hours later…
 
 
5 hours later…
9:49 AM
        function fn(){

          alert(1);

        }

        alert(fn.toString());
 
 
4 hours later…
1:25 PM
Any idea why I can't get this to work?
html += `  <textarea  class='form-control' rows='4' id='Comment_${idx}' id='Comment_${idx}' value='${Comment === null ? "" : `${Comment}`}'></textarea >`;
I building this html in JavaScript setting the value
 
1:39 PM
@Jefferson I can't see your complete code but by the looks of it, it looks like you're appending the HTML to a variable. This won't work. In JavaScript, you have to directly append the HTML to a valid HTMLElement.
This is valid: element.innerHTML += "..."
This is not valid: var html = element.innerHTML; html += "..."
 
 $("#submission").html(html);
Sorry I append it to a div and it displays fine just dont see the value in the UI
 
2:30 PM
@Jefferson What is this supposed to do and what does it do instead?
||> (function  () {
	const Comment = "comment";
	const idx = "idx";
	let html = "existing HTML";

	html += `  <textarea  class='form-control' rows='4' id='Comment_${idx}' id='Comment_${idx}' value='${Comment === null ? "" : `${Comment}`}'></textarea >`
	console.log(html);
})()
 
@VLAZ undefined Logged: [ '"existing HTML <textarea class=\'form-control\' rows=\'4\' id=\'Comment_idx\' id=\'Comment_idx\' value=\'comment\'></textarea >"' ] Took: 0ms
 
Seems to not throw an error or do anything bizarre.
Assuming you do have idx and Comment both defined, that is
 
2:49 PM
isn't textarea value supposed to be within the textarea, not in a value attribute?
 
2:59 PM
@KevinB Yes.
Also, constructing random HTML from string is just bad. If you're using jQuery anyway, just construct it programmatically. jQuery even handles the the correct value assignment for you if you do $(formElement).val("some value")
const textarea = $("<textarea/>")
    .attr({
      class: "form-control",
      rows: 4,
      id: `Comment_${idx}`,
  })
  .val(Comment === null ? "" : Comment);
 
3:18 PM
I not getting the value of the textarea
 
can you be a little bit more clear?
 
value='${Comment === null ? "" : ${Comment}}'
 
30 mins ago, by Kevin B
isn't textarea value supposed to be within the textarea, not in a value attribute?
 
so that is setting the value But I am not seeing it on the UI
textarea  class='form-control' rows='4' id='Comment_${idx}' id='Comment_${idx}' value='${Comment === null ? "" : `${Comment}`}'>'${Comment === null ? "" : `${Comment}`}'</textarea >
So I need it in both location ?
 
the value attribute is irrelevant
textareas don't have one
 
The .val() method is primarily used to get the values of form elements such as input, select and textarea.
they mean the value= right
 
on elements with a value attribute, yes
textarea is not one such element
!!mdn textarea element
 
3:47 PM
thanks
 
4:02 PM
Which is a better placeholder for unused variables (that will be used)? null or undefined?
I think null is the best because unlike undefined, it shows that it soon will be defined. undefined on the other hand makes it seem like the variable isn't used and there is no purpose to it.
||>let willBeUsedSoon = undefined;
||>let willBeUsedSoon = null;
Which is more appropriate?
 
4:30 PM
posted on April 18, 2024 by Ben Mason

Hi everyone! We've just released Chrome Dev 126 (126.0.6423.0) for Android. It's now available on Google Play. You can see a partial list of the changes in the Git log. For details on new features, check out the Chromium blog, and for details on web platform updates, check here. If you find a new issue, please let us know by filing a bug. Harry Souders Google Chrome

 
@ParkingMaster Usually null means "I have set this value to nothing intentionally" while undefined carries the meaning of "it's a nothing value because of circumstances". Uninitialised properties or variables are undefined. Also Array#find() and similar tend to return undefined if nothing is found.
That's not always strictly the case: getElementById() returns null if it doesn't find anything. But still.
Although it probably doesn't matter that much in the end. You can pick a convention and stick with it.
 
I think I'll still stick with null. It actually seems more commonly used in the language too, but it doesn't really matter.
 
 
1 hour later…
6:00 PM
i mean
i'd assume the most common usage is the laziest
let willBeUsedSoon;
 

« first day (4933 days earlier)