my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes Confusing jquery code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Confusing jquery code" Watch "Confusing jquery code" New topic

Confusing jquery code

David Mbura
Ranch Hand

Joined: Apr 06, 2010
Posts: 65
For some reason when i click book list element it shows both forms(books and classes) instead of just book form as if there is no break statement,i am really confused why is it doing that?
Matthew Brown

Joined: Apr 06, 2010
Posts: 4541

I just tried it out, and it seemed to work correctly (with including JQuery the only addition to the file). Are you sure that the code you posted is the code you're running?

From a stylistic point of view, I think it would be much better to add separate event handlers to the two elements, rather than adding the same event handler to each and then having to switch on the ID.
David Mbura
Ranch Hand

Joined: Apr 06, 2010
Posts: 65
Thank you for the advice.And actually the code i was running is a little different,but i figured that couldn't be the cause ,I will go over it again and see what i get...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63534

Always be sure to post a self-contained code example that you know shows the issue.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Confusing jquery code
It's not a secret anymore!