开发者

jquery: see if clicked element is select form, and output all the options on a new overlay

开发者 https://www.devze.com 2022-12-10 23:51 出处:网络
i am trying to do something like this in jquery. if ($(e.target) == \"select\"){ //var output = $(e.target).each option

i am trying to do something like this in jquery.

if ($(e.target) == "select"){
//var output = $(e.target).each option

//display newoverlay(outp开发者_JS百科ut)
}


How about:

if($(e.target).is('select')) {
    $('option', e.target).each(function() {
        /* "this" is the <option> element in here */
        // newoverlay(this)
    })
}

Although I'm not sure what you want to do with the individual <option> elements.

0

精彩评论

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