mercredi 12 août 2015

how to add shiftcheckbox to dynamic generated checkbox?

use this plugin: http://ift.tt/1NpJfVW or http://ift.tt/wUWRCY

(1)in js

for (var hidx in hosts) {
        var h = hosts[hidx];
        var line_html = '<tr><td><input type="checkbox" class="input shiftCheckbox"  value = "'+ hidx +'" data-fullname="'+ h +'"></input></td><td>' + h + '</td> </tr>';
        tbody_hosts.append($(line_html));
}

this is dynamic generated. (2)in html

<script src="/static/js/jquery.shiftcheckbox.js" type= "text/javascript" ></script>
<script type= "text/javascript" >       
    $(document).ready (function() {
        $('.shiftCheckbox').shiftcheckbox();
    });
</script>

why it does not work? because dynamic?




Aucun commentaire:

Enregistrer un commentaire