This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rob Dennett
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Rob Dennett
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic