Jquery-detect value change on hidden input field

Source: Internet
Author: User

You can simply with the below function, you can also change the type element.

$ ("Input[type=hidden]"). Bind ("change", function () {       alert (this). Val ());  });
 in value to hidden elements Don't automatically fire the. Change () event. So, wherever it's that's you'
<div id="message"></div><input type="hidden" id="testchange" value="0"  />    

Javascript

var$message = $ ('#message');var$testChange = $ ('#testChange');vari =1; function Updatechange () {$message. html ($message. HTML ()+'<p>changed to'+ $testChange. val () +'</p>');} $testChange. On (' Change', Updatechange); SetInterval (function () {$testChange. val (++i). Trigger (' Change');; Console.log ("value changed"+$testChange. Val ());}, the); Updatechange ();

should work as expected.

http://jsfiddle.net/7CM6k/3/

Reprint: Http://stackoverflow.com/questions/6533087/jquery-detect-value-change-on-hidden-input-field

Jquery-detect value change on hidden input field

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.