0

My code below is not working when I click on to the editlist class element disappears how can I make it appear again such as toggling the editLish class element with clicks any change in the below will be much appreciated as the content is generated on the fly

<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>
1
  • 3
    Your class is editList in the DOM, but your selector calls for .editlist. The selectors are case-sensitive. Commented Feb 7, 2013 at 17:31

3 Answers 3

1

Check your selector spelling - you've bound the click handler to editlist and your table class is editList.

Sign up to request clarification or add additional context in comments.

Comments

1

css class names are case sensitive. you need to change $('.editlist') to $('.editList') with a capital L

1 Comment

Hi I have updated the code thank you very much for the replies. But how can I manage to toggle the dynamic html content using jquery?
0

Your table class is "editList" but your jquery selector is ".editlist" (note the differing case on the L). Css names are case sensitive.

Using $('.editList').click(... will work

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.