I have a div with a span
<div id="div1">
<span class="">hello</span>
</div>
When i click on div i want to change the class of only first span element of the div
$('#div1').click(function() {
// ... check if first span element inside the div .. if there and change the class..
});
Best Answer
http://api.jquery.com/first-selector/
http://jsfiddle.net/BUBb9/1/