Jquery实时返回虚假问题

时间:2011-03-29 10:05:49

标签: jquery

问题jquery return false不能正常工作。

$("input").live("mouseup",function()
{
return false
});

// Outside click action
$(document).mouseup(function()
{
$("input").hide();
});

演示链接

http://demos.9lessons.info/table_edit/TableEdit.htm

3 个答案:

答案 0 :(得分:4)

尝试使用stopImmediatePropagation()

$("input").live("mouseup", function(e) {
    e.stopImmediatePropagation();
});

// Outside click action
$(document).mouseup(function() {
    $("input").hide();
});

jsfiddle上的代码示例。

答案 1 :(得分:0)

$("input").live("mouseup",function(e) {
    e.preventDefault();
    e.stopPropagation();
});

答案 2 :(得分:0)

试试这个:

 jQuery(document).ready(function() {
$("input").live("mouseup",function(event)
{
    return false;
});
});