Any good reason why $(‘p’).html(0) makes all paragraphs empty as opposed to contain the character ‘0’?
Instead of assuming I found a bug in jQuery, it’s probably a misunderstanding on my part.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
jQuery only accepts a string as an argument for the
valparameter of thehtml()method. If you pass a number like you are it will call thehtml()method override that sets the contents of the element but the value of the argument will end up being null or an empty string.Try this:
Relevant documentation