Double click function in jQuery is not working

自作多情 提交于 2019-12-05 14:31:22

try use inside $(document).ready()

$(document).ready(function(){

 $("[id^='shiftTime_']").dblclick(function() {
 alert("hello");
 });

});

Use .on if you plan to add elements dynamically (e.g. by using $( "body" ).append( "<span id='shiftTime_2'>1</span>" ); )

$( "body" ).on( "dblclick", "span", function() {
    alert( "This works also with dynamically added elements" );
} );

When I try the code, it works just fine:

http://jsfiddle.net/Guffa/pfQfK/

Check if there is something different from your code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!