3

I have a simple list : example : http://www.w3schools.com/html/html_lists.asp

I am using Mozilla Firefox (version 3.6 but I think version does not matter). When I click (single) on the bullet, the list item gets selected(highlighted).

Is there a way to disable this highlighting (without removing the highlighting forever using -moz-selection)?

This behavior is not seen in Chrome or IE. Another example : (with list-style-image) : http://www.sendesignz.com/Demo/jQuery/expanding_list_item/expanding.html

Is there a way in plain javascript or jQuery or css to disable this auto selection in FF?

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
TJ-
  • 14,085
  • 12
  • 59
  • 90

3 Answers3

2

It's functionality implemented by Firefox as you could tell, while I don't know of any true way to remove the functionality there is a CSS workaround you can do.

Wrap all contents of the <li> in a <span>, and then using margin, padding and absolute positioning to position the span over the list item.

HTML

<ul>
<li><span>Item</span></li>
<li><span>Item</span></li>
</ul>

CSS

li span{
    margin-left: -50px;
    padding-left: 50px;
    position: absolute;
}
Andre Backlund
  • 6,843
  • 3
  • 20
  • 27
2

You can use the mozilla css parameter

CSS

 li {-moz-user-select: none;}
barney
  • 21
  • 1
0

The selection seems to be related to the mousedown event. You can block it by stopping the event. For exemple in jQuery :

elt.mousedown(function(event){ return false; });
  • 1
    You should consider adding `if (event && event.preventDefault) event.preventDefault();` to your function as well. – S. Albano Sep 20 '12 at 15:07