2013-02-07 33 views
0

當我點擊到編輯列表類元素時,我的代碼不工作消失我怎樣才能使它再次出現,如點擊切換editLish類元素下面的任何更改將是多讚賞,因爲在飛行中生成內容jQuery與PHP一體化HTML不工作

<script type="text/javascript"> 
    $(document).ready(function(){ 
     alert("clicked"); 
     $('.editList').on('click',function(){ 
     alert('clicked'); 
        $(this).hide(); 
     }); 
    }); 
</script> 
<? $this->_renderView(false, '_submenu')?> 
<?php $cand_data=$this->read_xml(); 
    ?> 
<div class="module" style="width:1050px"> 
    <div class="module_content"> 
     <?php foreach($cand_data as $key=>$data_node){ $i=0; ?> 
     <table class="editList" style=""> 
      <tr> 
       <th>Candidate Data</th> 
      </tr> 
      <?php foreach($data_node as $label=>$val) { if($i<16){?> 
      <tr> 
       <td><?= $label?></td> 
       <td><?= $val?></td> 
      </tr> 
      <?php $i++;}}?> 
     </table> 
     <?php }?>  
    </div> 
</div> 
+3

你的類是'editList'在DOM,但'.editlist'您選擇電話。選擇器區分大小寫。 –

回答

1

檢查您的選擇拼寫 - 你已經綁定的點擊處理程序editlist,你的表類是editList

1

css類名區分大小寫。您需要將$('.editlist')更改爲$('.editList'),並且首字母爲L

+0

嗨我已經更新了代碼非常感謝您的答覆。但我怎樣才能設法切換動態html內容使用jQuery? –

0

您的表類是「editList」,但您的jquery選擇器是「.editlist」(請注意L上的不同情況)。 Css名稱區分大小寫。

使用$('.editList').click(...將工作