Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  60] [ 6]  / answers: 1 / hits: 52314  / 11 Years ago, wed, september 25, 2013, 12:00:00

I have an Id City on page which is basically a model property. I want to set it as null. I am trying this to achieve it:



$(#City).val(null); 


But it is not setting the value to null.


More From » jquery

 Answers
0

You don't set an elements value to null, as HTML has no concept of null, undefined etc, you remove the attribute, or better yet, set it to an empty string:



$(#City).val(); 

[#75435] Tuesday, September 24, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shylaelisan

Total Points: 37
Total Questions: 94
Total Answers: 110

Location: Angola
Member since Tue, May 5, 2020
4 Years ago
;