admin管理员组文章数量:1435208
I try to get .live content into a div when there is a keyup... I looked at the forumtopic here but I didn't find the answer...
Why does my code not works? I use this JQuery:
<script type="text/javascript" src="jquery-ui-1.7.1.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// When the document is ready set up our sortable with it's inherant function(s)
$(".atleetnaamlink").live('keyup', function(){
alert('test');
});
</script>
I try to get .live content into a div when there is a keyup... I looked at the forumtopic here but I didn't find the answer...
Why does my code not works? I use this JQuery:
<script type="text/javascript" src="jquery-ui-1.7.1.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// When the document is ready set up our sortable with it's inherant function(s)
$(".atleetnaamlink").live('keyup', function(){
alert('test');
});
</script>
Share
Improve this question
asked Nov 10, 2012 at 9:30
Olivier PeetersOlivier Peeters
612 silver badges7 bronze badges
1
- $(selector).live(events, data, handler); // jQuery 1.3+ $(document).delegate(selector, events, data, handler); // jQuery 1.4.3+ $(document).on(events, selector, data, handler); // jQuery 1.7+ – Pragnesh Chauhan Commented Nov 10, 2012 at 9:30
4 Answers
Reset to default 3try on
$(selector).live(events, data, handler); // jQuery 1.3+
$(document).delegate(selector, events, data, handler); // jQuery 1.4.3+
$(document).on(events, selector, data, handler); // jQuery 1.7+
$(document).ready(function() {
$("body").on('keyup' ,'.atleetnaamlink', function(){
alert('test');
});
});
DEMO
.live()
is deprecated. Use .on()
instead. That will work.
$(".atleetnaamlink").on('keyup', function(){
alert('test');
});
You are missing });
and Working demo http://jsfiddle/JwRRH/
Hope it helps :)
by the way live
is deprecated and if you keen check this out What's wrong with the jQuery live method?
code
$(document).ready(function() {
// When the document is ready set up our sortable with it's inherant function(s)
$(".atleetnaamlink").live('keyup', function(){
alert('test');
});
});
or*
$(document).ready(function() {
// When the document is ready set up our sortable with it's inherant function(s)
$(document).live('keyup',".atleetnaamlink", function(){
alert('test');
});
});
Add this above:
<script type="text/javascript" src="http://code.jquery./jquery-latest.js"></script>
<script type="text/javascript" src="jquery-ui-1.7.1.custom.min.js"></script>
and see if this works.
and important thing not to forget to accept it if it solves your issue.
本文标签: javascriptJQuery live doesn39t workStack Overflow
版权声明:本文标题:javascript - JQuery live doesn't work - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745649434a2668335.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论