Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 463
  • Last Modified:

Need jQuery selector to find first li inside an ul

I have an ul and neeed to updatee the text for the first li contained by the ul. What is thhe exact jQuery syntax for that?

Thanks!
0
newbieweb
Asked:
newbieweb
  • 2
2 Solutions
 
leakim971PluritechnicianCommented:
You may use : http://api.jquery.com/first-selector/

$("ul>li:first").html("hello");
0
 
leakim971PluritechnicianCommented:
or : http://api.jquery.com/eq-selector/
$("ul>li:eq(0)").html("hello");
0
 
newbiewebAuthor Commented:
Thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now