This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

submit option value

 
James Whillis
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a form.



But when I submit it with

it does not submit selected option.( I mean I should be able to get but it's null)

I need to add option value manually to response or what's is wrong?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try: $("#form-response").get(0).submit();
 
James Whillis
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Try: $("#form-response").get(0).submit();


It works!But what does get(0) give?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the difference between calling jQuery's submit() method (your original code), and calling the form's JavaScript submit() method.

The .get(0) fetches a reference to the first (and in this case only) element in the jQuery wrapped set.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic