Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change event of html hidden field

Tags:

jquery

I want to check the change of html hidden field using jquery and i tried for this but the change event did not worked.

Somebody has and idea how to handle this?

like image 804
munish Avatar asked Nov 01 '10 07:11

munish


People also ask

How do I hide hidden fields in inspect element?

It is not possible to hide elements from the DOM inspector, that would defeat the purpose of having that tool. Disabling javascript is all it would take to bypass right click protection. What you should do is implement a proper autologin.


1 Answers

The change event doesn't fire when the value is programmatically changed, if it did it would cause infinite loops in many situations.

If you need the event to fire, then trigger it when changing the value yourself using .change(), like this:

$("#hiddenId").val("new value").change(); 

.change() is a shortcut for .trigger("change") or, if you don't want that change event to bubble for some reason, then use .triggerHandler("change").

like image 109
Nick Craver Avatar answered Sep 22 '22 14:09

Nick Craver