Выполнить функцию jQuery при смене вниз

Я написал функцию jQuery, которая в настоящее время работает в Click Event. Мне нужно изменить его так, чтобы он выполнялся при изменении значения выпадающего списка (Select-Option). Вот мой код:

<form id="form1" name="form1" method="post" action="">
  <label>
    <select name="otherCatches" id="otherCatches">
      <option value="*">All</option>
    </select>
  </label>
</form>

$("#otherCatches").click(function() {
    $.ajax({
        url: "otherCatchesMap.php>",
        success: function(msg) {
            $("#results").html(msg);
        }
    });
});

Ответы

Ответ 1

Используйте change() вместо click():

jQuery(document).ready(function(){
  $("#otherCatches").change(function() {
    $.ajax({
     url: "otherCatchesMap.php>",
     success: function(msg){
       $("#results").html(msg);
     }
   });
  });
});

Ответ 2

http://api.jquery.com/change/

$(function() {
    $("#otherCatches").change(function() {
       $(this).val() // how to get the value of the selected item if you need it
    });
});

Ответ 3


$("#otherCatches").change(function () {
    //// Your code        
});