SyntaxFix
Write A Post
Hire A Developer
Questions
Depending on the usecase it makes a difference whether you use javascript (element.value = x) or jQuery $(element).val(x);
element.value = x
$(element).val(x);
When x is undefined jQuery results in an empty String whereas javascript results in "undefined" as a String.
x
undefined
"undefined"