samedi 29 mars 2014

JQuery Toggle With Html Table


Vote count:

0




I have a table that hides the rows from a parent tr


By using this jquery code:



$(document).ready( function() {
$('tr.toggleChild').hide();
$('tr.toggleMain').click( function(e) {
e.preventDefault();
$(this).nextAll().each( function() {
if ($(this).filter('tr.toggleMain').length) {
return false;
}
$(this).filter('tr.toggleChild').toggle();
});
});
});


if I click on tr main, I can not use other connections, because it always acts tul command toggle and I can not use these links.


I added a picture on the first td of the tr main, adding the find function to earlier this jquery code:



$(document).ready( function() {
$('tr.toggleChild').hide();
$('tr.toggleMain').find('img.imageToggle').on('click', function(e) {
e.preventDefault();
$(this).nextAll().each( function() {
if ($(this).filter('tr.toggleMain').length) {
return false;
}
$(this).filter('tr.toggleChild').toggle();
});
});
});


but it does not work, does not do anything wrong, where do you have any suggestions?


Thank you!



asked 48 secs ago






Aucun commentaire:

Enregistrer un commentaire