<label id="error_msg"></label>
Now, I want to alert a message that please fill text-box, whenever there is change in value of error_msg
Also, I want to check whether label is empty or not. If label is empty, then alert should not come.
I wrote the code, but it’s not working somehow
$("#error_msg").change(function () {
alert('hi');
});
Help guys.
You need to monitor Dom changes for label. Check out the easy to use jQuery plugin at http://james.padolsey.com/javascript/monitoring-dom-properties/
If you are trying to validate, i highly suggest using the validation plugin http://bassistance.de/jquery-plugins/jquery-plugin-validation/