vendredi 4 septembre 2015

Jquery .click() function on a checkbox does not run when I click it [duplicate]

This question already has an answer here:

I'm trying to add a checkbox to header of my table . For this purpose I've written the following lines of codes:

tableHead+='<th> <input type="checkbox" id="select_all"/> </th>';

$("#select_all").click(function(){
    alert('clicked!');
})

html

<div>
    <h5 style="float:left;">Results - Table</h5>
    <button id="download-json" class="btn" style="float:right;"><i class="icon-download"></i> Get JSON</button>
    <button id="download-csv" class="btn" style="float:right;"><i class="icon-download"></i> Get CSV</button>
    </div>
    <br>
    <div id="results_container">
    <p>Execute a query first!</p>
    </div>

</div>

Unfortunately, Altough checkbox appear on my table, when I clicked on it, nothing happens. I mean there is no alert message. What should I do to fix it?




Aucun commentaire:

Enregistrer un commentaire