我是jquery的新手,我想知道当光标离开/离开输入元素/标记时,如何获取输入标记的值。提前谢谢你。
发布于 2012-10-03 10:51:44
使用事件
 $(function() {
    $('input[type="text"]').on('blur' , function() {
        // Your code here
    });
  });CHECK DEMO
发布于 2012-10-03 10:55:32
我认为你搜索的方法是focusout
$(function() {
    $('#input-element').focusout(function() {
        // put your code here!
    });
});我希望它能帮上忙。
发布于 2012-10-03 10:59:11
<form>
  <input id="target" type="text" value="Field 1" />
  <input type="text" value="Field 2" />
</form>
<div id="other">
  Trigger the handler
</div>
<script>
$('#target').blur(function() {
  alert('Handler for .blur() called.');
});https://stackoverflow.com/questions/12701252
复制相似问题