aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Does the jQuery val() function not work in IE7 & IE8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Does the jQuery val() function not work in IE7 & IE8" Watch "Does the jQuery val() function not work in IE7 & IE8" New topic
Author

Does the jQuery val() function not work in IE7 & IE8

Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
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: 61623
    
  67

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?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
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