aspose file tools*
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
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: 1419
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: 61010
    
  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: 61010
    
  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: 61010
    
  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: 1419
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: 61010
    
  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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Click event is not firing