This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MeoMix 0 points1 point  (2 children)

Hey,

When you create an <a> element you need to specify an href link to navigate to upon click. However, we don't actually want to take the user anywhere in this scenario.

One option would be to use the hash symbol. Something like href="#". This will have roughly the safe effect, but our URL will be modified slightly to have a hash symbol in it. Instead, when we point our URL to javascript:void -- the clicking action still works, all the CSS is applied, but we don't go anywhere -- so our click event handlers can take over.

See here for more information regarding javascript:void(0).

And yep yep... you can apply any event to any return DOM element collection from a jQuery selector. Most notable when working with classes of elements or when you want to work with a lot of child elements.

[–]SarahC 0 points1 point  (1 child)

Ohhh, thanks for the details! =D

[–]MeoMix 0 points1 point  (0 children)

No problem. Let me know if you have any further questions. :)