When we use the method jQuery.Val( value ) over a DOM element to change its value.
Shouldn’t the element dispatch an event informing that its value has changed? -I though the event ‘change’ was going to be dispatched.
If it shouldn’t why?
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.
It’s not dispatched, this just doesn’t happen when it’s programmatically changed. You are however free to fire the event when needed like this:
You can test it here.
The reasoning? If the user changed something you may need to react, but if you changed something then you know what happened, and firing an event handler may be completely wasteful…so it’s up to you to call that event handler if it’s needed.