Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting hidden field value with Jquery $('#id').attr("value", 'val'); not working in IE

I noticed that IE doesnt fill the value of a hidden field, using the code below, while Chrome and FF have no problem with this.

$('#id').attr("value", 'val');

I tried a few other things like .setAttribute or .val() = "val";

like image 362
TrustMe Avatar asked Nov 15 '12 16:11

TrustMe


1 Answers

You need to pass value to val() jquery function,

$('#id').val("your value");
like image 184
Adil Avatar answered Sep 23 '22 09:09

Adil