I have this jquery selector
$('.accordion label').live('click',function() {
alert("hello clicky clicky");
}
but if I do this
$('.accordion label:first').live('click',function() {
alert("hello clicky clicky");
}
it targets label of first accordion rather than the first label of every accordion
could someone please help
EDIT
HTML
<fieldset class="horizontal accordion">
<label class="categorylabel"><div class="accordion_open"></div>Editor Information</label>
<ul>
<li>
<label for="editor" id="editorL"><div class="accordion_open"></div>Editor Name</label>
<input id="editor" name="editor" class="force_clean" value="" type="text">
</li>
</ul>
</fieldset>
Use the
first-childselector instead offirst.firstgives you the first instance in the entire set.first-childgives you each in the set that is the first child of its parent.or just use the class name you provided (assuming it is the same for each accordion).