Jquery Exclude a Selector?

后端 未结 5 2257
渐次进展
渐次进展 2021-02-14 22:00

I\'ve got a form that I clear on focus. I\'ve selected the whole form and it works great except that the submit button goes blank when I click it.

how can I exclude my i

相关标签:
5条回答
  • 2021-02-14 22:42
    $(".wpcf7-form input:not(#submit), .wpcf7-form textarea")
    

    not

    0 讨论(0)
  • 2021-02-14 22:42

    Use the not selector to exclude what you want:

    $(".wpcf7-form input:not('#submit_id'), .wpcf7-form textarea").focus(function() {
     // your code......
    }
    

    Or

    $(".wpcf7-form input:not(input[type=submit]), .wpcf7-form textarea").focus(function() {
     // your code......
    }
    
    0 讨论(0)
  • 2021-02-14 22:49

    Use .not() to exclude your input button (or buttons) from the set of inputs you already have.

    $('input.are.blong.to.us') // give me a bunch of inputs
        .not('#submit')        // exclude input#submit
        .focus( ... )          
        .blur( ... );
    
    0 讨论(0)
  • 2021-02-14 22:50

    You could use the css3-not selector.

    A selector like that would be: input:not([type=submit]).

    Example here: JsFiddle.

    More info about the not-selector here.

    0 讨论(0)
  • 2021-02-14 22:57

    You want the not-equal to selector:

    .wpcf7-form input[id!=submit]
    

    or

    .wpcf7-form input[type!=submit]
    
    0 讨论(0)
提交回复
热议问题