jQuery .click() not binding properly
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-05-12T13:13:21Z
Indexed on
2010/05/12
13:14 UTC
Read the original article
Hit count: 102
jQuery
I want to perform some action when a link is clicked, I am using the following code to achieve this however it rarely works. If I click the link it usually refreshes the page, and 1/10 times it'll actually pop up "Hi". What is wrong?
$(document).ready(function()
{
$('#slconfiglink').click(function()
{
alert("hi");
return false;
});
});
HTML:
<ul>
<li><a href="" id="slconfiglink">Config 1</a></li>
</ul>
© Stack Overflow or respective owner