How to get the first element of the child using Jquery ?
Started on: 15 February 13
Participants: 1
I am using jquery to change my element style.I want to get the first child element from a parent div.
my example
from the above html i want to get only the first child of the parent div
i tried below jquery code but it takes all the child
$("#parent div").each(){
}
help me to get the first child only , child1 element for the above example.
my example
from the above html i want to get only the first child of the parent div
i tried below jquery code but it takes all the child
$("#parent div").each(){
}
help me to get the first child only , child1 element for the above example.
This challenge is listed under
Development & Implementations
Community
Related Posts:
1 Suggestion
try the below jquery
$("#parent").each(){ $(this).children("div:first").attr("id") }