私がドロップダウンを持っていると私はオプションを選択すると、これがあるとき、私はまたjqueryまたはjavascriptは、イベントに動的にロードされると実行されますか?
<table id="dataFileTableHeader">
<thead>
<tr>
<th><strong>Export Type</strong></th>
<th><strong>Company</strong></th>
<th><strong>File Name</strong></th>
<th><strong>Date Modified</strong></th>
<th><strong>Total Records</strong></th>
<th><strong>File Size</strong></th>
<th><strong>Owner</strong></th>
</tr>
</thead>
</table>
<script>
$(function(){
var i = 0;
$('#dataFileTableHeader th').each(function(index) {
alert("hello " + (++i));
});
});
</script>
、のような小さなjQueryのスクリプトを送信するテーブルと一緒に、それは、サーバから適切なテーブルをロードするとjQueryを使用して、それを表示しますロードされた私はalert
が7回現れることを期待しているが何も起こらない何かが不足している?あなたはまた、単に内のインデックスを使用することができます
<table id="dataFileTableHeader">
<thead>
<tr>
<th><strong>Export Type</strong></th>
<th><strong>Company</strong></th>
<th><strong>File Name</strong></th>
<th><strong>Date Modified</strong></th>
<th><strong>Total Records</strong></th>
<th><strong>File Size</strong></th>
<th><strong>Owner</strong></th>
</tr>
</thead>
</table>
<script>
$(function(){
var i = 0;
$('#dataFileTableHeader th').each(function(index) {
alert("hello " + (++i));
});
});
</script>
最も重要なコードは、テーブルをロードするコードです。通常、AJAXが関与しているときは常に、コールバック関数があります。または、そのスクリプトに尋ねる方法が実行結果です。 – madth3