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>
Note that the ID's are not replicated elsewhere in the HTML