| Author |
Does the jQuery val() function not work in IE7 & IE8
|
Rob Dennett
Ranch Hand
Joined: Dec 07, 2010
Posts: 77
|
|
I have some code where I am setting the value of a hidden input using jQuery's val function: $('#myInputId').val(theNewVal); When I step through with the debugger, $('#myInputId').val() has the new value in it.
After the function is complete, some other code is getting triggered (it's in the handler for $('#theForm).submit()) and when I set a breakpoint on the first line, $('#myInputId').val() has the old value in it. What gives? This works fine in other browsers, BTW. I implemented a work around by also setting the text of a hidden span and setting the value of the input on the first line of the submit handler, but this is truly annoying.
Thanks,
Rob
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
Not any problem that I've seen or heard wind of. Are there other handlers that may firing that are performing an assignment or doing a form reset?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Rob Dennett
Ranch Hand
Joined: Dec 07, 2010
Posts: 77
|
|
Ah, I forgot about the reset. I will make that change, but why does it work in other browsers? Do they not reset hidden fields?
Thanks,
Rob
|
 |
 |
|
|
subject: Does the jQuery val() function not work in IE7 & IE8
|
|
|