Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my onclick event not registered in Firefox?

I have a list item with an onclick event. It runs in Chrome and Internet Explorer, but not Firefox. Any suggestions?

<li onclick="alert('test');">test test<br></li>
like image 671
hdayi Avatar asked Oct 07 '22 16:10

hdayi


1 Answers

This works fine for me in Firefox.

Check this:

  1. JavaScript is enabled in your browser.

  2. Try adding a return false; statement in your tag.

Or a function like this:

function test() {
    //your code here
    return false;
}
  1. Or use this:

<a href="#" onclick="alert('hi');">Link</a>

or this

<a href="javascript:void(0)" onclick="alert('hi');">Link</a>

like image 136
Jason Stackhouse Avatar answered Oct 10 '22 07:10

Jason Stackhouse