[英]Draggable cancel triggering blur event
I have a draggable div which of course could be dragged around. 我有一个可拖动的div当然可以被拖走。 Inside, I have input text which has two events (focus and blur). 在里面,我输入了两个事件(焦点和模糊)的文本。 Also inside, I have another div which serve as draggable cancellation div (dragging that div prevent any drag to occur). 在内部,我有另一个div作为可拖动的取消div(拖动该div防止任何拖动发生)。
you could see it here: http://jsfiddle.net/wUDzh/4/ 你可以在这里看到它: http : //jsfiddle.net/wUDzh/4/
is there any way to prevent blur event to occur just like the behavior of the main div? 有没有办法防止模糊事件发生就像主div的行为?
thx 谢谢
You could do 你可以做到
$("#text").blur(function(e)
{
// alert('a');
if(e.target.id === 'text'){
//this prevents other blur handlers from firing
e.stopImmediatePropagation();
//this prevent the default action and returns
return false;
}
$(this).val("I've got blur");
});
fiddle here http://jsfiddle.net/wUDzh/6/ 在这里摆弄http://jsfiddle.net/wUDzh/6/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.