开发者

dropdown: two type of events can't bind of jquery in chrome

their is some problem of click event in 开发者_如何学运维chrome

<select id="id-name" name="name-her">
        <option value="">Select</option>
        <option value="1" class="verify">Verify</option>
        <option value="2" class="delete">Reject</option>
</select>

$('.verify').bind("click", function( evt ){
    alert('clicked');
});

$('.delete').bind("click", function( evt ){
    alert('clicked');
});

here we want to initiate two events on the basis of class which one is clicked, It works fine in firefox but not in chrome.

Any suggestion please ?


<select id=”category”>
   <option value=”3″ onclick=”getOption(3);”>Option1</option>
</select>

This works fine in Firefox, i.e. the function ‘getCategories’ gets called when choosing an object in the select box. This does not work for the other browsers though, the calls are not made and there are even no errors raised.

The solution is to make the function call on the select-tag instead using the onchange-event referencing the value of the select tag (which will hold the value of the chosen option-tag),

<select id="category" onchange="getOption($('category').val());">
   <option value="3">Option1</option>
</select>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜