This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Click event is not firing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Click event is not firing" Watch "Click event is not firing" New topic
Author

Click event is not firing

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I upgraged my jQuery from 1.3 to 1.7.2 and now the click event will not work in following jsp.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Please post an SSCCE (Short Self-Contained Correct Example) that demonstrates the issue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Also remove the "javascript:" prefixes from the on click attributes. They are unnecessary and just make the code look grody. And speaking of on click attributes, as you are using jQuery, why are they there at all? All the JavaScript should be removed from the structural markup.

And it's best to show rendered HTML rather than server-side markup when dealing with JavaScript issues.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
That JavaScript code is copy/paste happy.

Give all the elements that you want to hide a class, use a jQuery selector with the class to hide all of the elements. Do not reference them all individually.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Also, .css({display: "none"}); should simply be .hide().

Once you've refactored the code, there are lot more suggestions for improvements.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I figured pou that in the click code I have two functions. It seems the first function was being bypassed and the second function was being fired, which did nothing(code was changed in the past and function was nolonger necessary). Is this a normal behavior for jQuery 1.6 and above to only handle one function?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Steve Dyke wrote:I figured pou that in the click code I have two functions. It seems the first function was being bypassed and the second function was being fired, which did nothing(code was changed in the past and function was nolonger necessary). Is this a normal behavior for jQuery 1.6 and above to only handle one function?


Post what you are a talking about. I'm not going to go back and search through your overly long code to find it.
 
Consider Paul's rocket mass heater.
 
subject: Click event is not firing
 
Similar Threads
scroll bar down
Pressing the enter key receive extra invalid data
Fieldset is not working
Fieldset is not working
DIV Tag Loading Behavior is Erratic