This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[jQuery] Calling event code programmatically  RSS feed

 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a dropdown with ID “show_id” in my JSP. I have a .js file included in JSP which has following code.



Whenever I change the value of dropdown (show_id), above piece of code is getting executed automatically.

Now I have a requirement where I need to change the value of dropdown(show_id) programmatically using JavaScript. But when I do that above piece of code does not get executed.

How to get above code executed?



 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The onchange event does not get fired when you change the value with JavaScript. Looks like you are using jQuery so you can trigger it.

$("#showId").change();

Eric
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!