0

Possible Duplicate:
Prevent select dropdown from opening in FireFox and Opera

I have a select tag in html file, what i want is to open my own table on clicking this Select tag. but with this option window of Select tag also opens which i dont want to.
Is there any way so that option will not open in SELECT tag?

Community
  • 1
  • 1
Abhinav
  • 41
  • 5

1 Answers1

1

SELECT drop down menu is opened right after you trigger mousedown event. To prevent it from opening, you must block the event on mousedown so that it won't trigger any further event. This is the example:

function test() {
  // do something here
  return false;
}

with HTML

<select onmousedown="test();"><!-- options here --></select>

OR

function test() {
  // do something here
}

with HTML

<select onmousedown="test(); return false;"><!-- options here --></select>

The difference is with the 1st method, you can't call anymore function in the mousedown event on the SELECT tag. But you can do it with the 2nd method right before return false;

Iqbal Djulfri
  • 718
  • 6
  • 14