Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/426.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Jquery选择错误的td.class_Javascript_Jquery_Html - Fatal编程技术网

Javascript 使用Jquery选择错误的td.class

Javascript 使用Jquery选择错误的td.class,javascript,jquery,html,Javascript,Jquery,Html,我正试图得到一个带有动态加载表特定信息的警报。。 这就是我已经有的代码 $('#notizenTable tr.notizenTableRow').each(function () { var $this = $(this).data({ position: $(this).index() }), $input = $this.find('input'); $anlage = $this.find('td.stmAnlagedaten'); $input.bind

我正试图得到一个带有动态加载表特定信息的警报。。 这就是我已经有的代码

$('#notizenTable tr.notizenTableRow').each(function () {
    var $this = $(this).data({ position: $(this).index() }),
    $input = $this.find('input');
    $anlage = $this.find('td.stmAnlagedaten');
    $input.bind('change', function () {
        alert($anlage.html());
        cb = $(this);
        cb.val(cb.prop('checked'));
        alert("Hauptnotiz;" + $(this).val() + ";" + $anlage.html());

    })

})
Html:



所以现在我的问题是,我用JS获得了关于$input的正确信息(我知道它是因为alert),但它发现了stmAnlagedaten类的错误td,有人能解释为什么吗?我搜索的方式是否错误?

警报中$anlage.html()的实际输出是什么?(如果使用console.log而不是alert,复制文本会更容易)我现在不能检查控制台,明天我可以。$anlage.html()的输出是我发现错误的最后一行或第一行生成的(我现在不知道生成的顺序)。。。我的$input=$this.find('input')。。。。。真有趣。如果您希望在将来更容易地捕获相同类型的错误,可以使用“use strict”;如果试图在没有var语句的情况下设置变量,则会引发错误。然后你就可以直截了当地解决问题了。酷,我不知道这一点,信息请点击这里!)
    <tr class="notizenTableRow" data-counter="<!$MG_NotizID>">
            <td class="shrink tdcenter"><input type="checkbox" class="stmStickyNotizen" id="chkboxStickyNotizen" style="margin-left:3px;" value="false" data-chkboxselector="<!$MG_NotizID>"/></td>
            <td class="shrink stmAnlagedaten"><!$MG_AnlageDatum>&nbsp;<!$MG_AnlageZeit>&nbsp;&nbsp;<!$MG_AnlSachbearbeiter> <!$MG_AenSachbearbeiter></td>
            <td class="shrink"><!$MG_VorgangsartBez></td>
            <!-- style="width: 20%;" -->
            <td class="shrink"><!$MG_Thema></td>
            <td class="expandNotizen"><!$MG_Notiz></td>
            <td class="hiddenTableColumn" id="stmNotizenStatus"><!$MG_Status></td>
            <td class="hiddenTableColumn"></td>
    </tr>