JQuery从文本框中删除焦点

Koh*_*rik 3 jquery

如何在JQuery中删除TextBox的焦点?

编辑:这是我正在寻找的解决方案:

$(this).trigger('blur');
Run Code Online (Sandbox Code Playgroud)

原因不明,$(this).blur();没有用.我创建了一个新的,清晰的解决方案然后它工作.

Mi-*_*ity 5

JS小提琴

$(function () {
    $('input[type=text]').focus(function () {
        $(this).val('');
        // add the below line to trigger the blur event
        $(this).trigger('blur'); 
    });
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<input type="text" value="abcdef"> 
Run Code Online (Sandbox Code Playgroud)