This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes [jQuery] Calling event code programmatically 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 "[jQuery] Calling event code programmatically " Watch "[jQuery] Calling event code programmatically " New topic
Author

[jQuery] Calling event code programmatically

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3640
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?




My blood is tested +ve for Java.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15385
    
    6
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
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: [jQuery] Calling event code programmatically
 
jQuery in Action, 3rd edition