I have a kind of nested tabs structure where parent tab has id “parent_id” and child has id “child_id”
Initially both are closed which are to opened on document ready click.On document ready I need to open them both.
Code which i wrote for this was:
$(document).ready(function(){
$("a#parent_id").click();
$("a#parent_id").click(function(){$("a#child_id").click();});
});
Here parent tab was opening but child was not, I need to open both(parent and child on document ready) Any reasons for this?
Any help would be appreciated..
Thanks
You are triggering the
eventfor the parent before you assign a function to it.Do it like this: