So I have this code:
jQuery('div[class="someClass"] :input:not(:button)').each(functi开发者_如何学Pythonon() {               
    if (input type is drop-down) {
        //do something
    }
    else {
        jQuery(this).attr("value",null);
    }
}
I have selected all inputs except buttons in a specific class. Now for each input selected, if the input is a drop-down list I wish to do something, otherwise I wish to set the input to blank, which the last line does. How can this be accomplished?
You could use the is() method:
if ($(this).is('select')) {
    //do something
} else {
    $(this).val('');
}
Should ignore all input type button and button elements.
$('.someClass').each(function(){
    if ($(this).is('select')) {
        //do something
    } else if ($(this).not('input[type="button"]') && $(this).not(':button')){
        $(this).val('');
    }
});
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论