Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Click event is not firing

 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64826
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post an SSCCE (Short Self-Contained Correct Example) that demonstrates the issue.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64826
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64826
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64826
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic