jquery form change detection

问题描述:

不错的脚本。有人可以请向我解释如何与其他形式的标签,如无线电和文件上传。jquery form change detection

有梦天

尝试这个代码,

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
        "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
    <script src="../jquery-latest.js"></script> 

    <script> 
    $(document).ready(function(){ 

    $("select").change(function() { 
      var str = ""; 
      $("select option:selected").each(function() { 
       str += $(this).text() + " "; 
       }); 
      $("div").text(str); 
     }) 
     .change(); 

    }); 
    </script> 
    <style> 
    div { color:red; } 
    </style> 
</head> 
<body> 
    <select name="sweets" multiple="multiple"> 
    <option>Chocolate</option> 
    <option selected="selected">Candy</option> 
    <option>Taffy</option> 
    <option selected="selected">Carmel</option> 
    <option>Fudge</option> 
    <option>Cookie</option> 
    </select> 
    <div></div> 
</body> 
</html> 

$("input").change(function(){ 
    // do something 
}); 

Click here以获取更多信息。