Friday 24 February 2012

get Hidden Field in Jquery

The following doesn't work for me to set the value of a hidden form field with FireFox 9:
Copy code
  1. <input type="hidden" name="hiddeninputname" value="" />
with
Copy code
  1. $('input[name=hiddeninputname]').val(theValue);

However, using style="display:none;" the following does work:
Copy code
  1. <input style="display:none;" id="hiddeninputid" name="hiddeninputname" value="" />
with
Copy code
  1. $('input[id=hiddeninputid]').val(theValue);
or
Copy code
  1. $('input[name=hiddeninputname]').val(theValue);

No comments:

Post a Comment