How do you select a div which is a child of the current $(this)?
I have many divs with the class row, in each of which I have a hidden div called form_explanation. I want to show() the div form_explanation when the row is onClick-ed.
Thanks!
How do you select a div which is a child of the current $(this)?
I have many divs with the class row, in each of which I have a hidden div called form_explanation. I want to show() the div form_explanation when the row is onClick-ed.
Thanks!
$('.row').bind('click', function () {
$(this).children('div.form_explanation').show();
});
If you want to hide all other divs:
$('.row').bind('click', function () {
$('div.form_explanation:visible').hide();
$(this).children('div.form_explanation').show();
});
try this out for your specific problem
$('.row').click(function() {
$('div#form_explanation').show('fast'); //or div.form_explanation you didn't specify
});
with regards to the first part of your question, you could do something like this in general:
$(this).children('div');
or something like if you don't have the $(this)
$('parent > child');