jQuery get value of select onChange

后端 未结 16 1892
星月不相逢
星月不相逢 2020-11-22 05:31

I was under the impression that I could get the value of a select input by doing this $(this).val(); and applying the onchange parameter to the sel

16条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 05:40

    Look for jQuery site

    HTML:

    Trigger the handler

    JAVASCRIPT:

    $( ".target" ).change(function() {
      alert( "Handler for .change() called." );
    });
    

    jQuery's example:

    To add a validity test to all text input elements:

    $( "input[type='text']" ).change(function() {
      // Check input( $( this ).val() ) for validity here
    });
    

提交回复
热议问题