I have my main div
with title="apple"
and nested divs with no title tag. When I write code to show main div with "apple"
title only the main div
is getting displayed, the nested divs doesn't get displayed. How to display all child divs even if they don't have title tag? Here is the code below.
<div title="apple">
<div>Hi..</div>
</div>
And the jQuery
$('input#showapple').click(function(){
$("div *[title='apple']").show(2000);
});
$('input#hideapple').click(function(){
$("div *[title='apple']").hide(2000);
});
You can do them both in one using toggle
plus you don't need to specify the input
argument when selecting by ID, jQuery will only return the first matched element on ID (because there should only be one):
$('#showapple, #hideapple').click(function(){
$("div[title='apple'] > div").toggle(2000);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With