开发者

IE prevent select list change event on keyboard scroll

I'm having a problem with the change event on a select list in IE vs Chrome. When the option list is closed the change event in IE fires when scrolling through the list with the keyboard. In Chrome with change event does not fire when scrolling.

What is the best way to have IE behave like Chrome?

http://jsfiddle.net/mTLrY/4/

<select>
    <option>1</option>
    <option>2</option&g开发者_开发问答t;
    <option>3</option>
    <option>4</option>
    <option>5</option>
</select>

$('select').change(function(){
    alert('changing');
});


Try using onBlur instead of onchange. onblur is for when the control looses focus, which sounds like what you might actually want. I'm pretty sure the jquery is just $('select').blur(function(){....


you can try using the onchange attribute in the select tag. Fire the required javascript function when the state of this select list has changed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜