在ajax调用之后,onclick jquery无法正常工作 [英] onclick jquery not working after ajax call

查看:109
本文介绍了在ajax调用之后,onclick jquery无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我对jQuery完全不熟悉。



我写过这样的onclick事件:



 $( document )。ready( function  (){
$(' body')。find(' .litestonetable')。each( function (){
var mTab​​le = $( this );
$( this )。find(' tr:first')。children( ).eq( 0 )。find(' table' )。find(' tr:last')。children()。eq(< span class =code-digit> 0 )。f ind(' span')。on('' 点击' function (){
var _mid = $(mTable).parent()。next(' table' ).find(' tbody')。find(' tr')。children()。eq( 1 )。find(' input')。val();
// 其他一些事情要做。
});

});
});







工作正常。但是当我打电话给ajax时,它就会停止工作。我已经想通了,我必须这样写:



 $(文档)。on('  click'' 。someclassName' function (){

});







但是我无法转换上面的代码,类似于下面的代码。请帮助。

解决方案

document )。ready( function (){


' body')。find(' .litestonetable')。each( function (){
var mTab​​le =


);

Hi I am completely new to jQuery.

I have written an onclick event like this:

$(document).ready(function () {
         $('body').find('.milestonetable').each(function () {
            var mTable = $(this);
            $(this).find('tr:first').children().eq(0).find('table').find('tr:last').children().eq(0).find('span').on('click', function () {
                var _mid = $(mTable).parent().next('table').find('tbody').find('tr').children().eq(1).find('input').val();
             //some other things to do.
            });

         });
    });




Its working fine. But when I call an ajax, it stops working. I have figured out that I have to write it something like this:

$(document).on('click','.someclassName', function () {  

       });




But I am unable to convert the above code similar to the code below. Kindly help.

解决方案

(document).ready(function () {


('body').find('.milestonetable').each(function () { var mTable =


(this);


这篇关于在ajax调用之后,onclick jquery无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆