This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply 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: 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
    
  13

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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Does the jQuery val() function not work in IE7 & IE8
 
Similar Threads
passing a hidden input as parameter
single quote throws exception - JDK 1.4.2 and SQL Server
Preventing password alerts
creating a common jsp for many JSPs
doubts in Login page