I am having a problem with jquery. My HTML is
Others have provided their answers already but let me give you some more alternatives.
$("span.test:first").text("Welcome");
$("#first span.test").text("Welcome");
$("span.test").first().text("Welcome");
$("span.test").eq(0).text("Welcome");
$("span.test", "#first").text("Welcome");
The second and last one likely being the fastest because they target particular container by ID.
(internal jQuery optimisations may prove me wrong with any future version)
Here's a JSPerf test that performance compares upper possibilities. As anticipated, the second and last approaches are the fastest of all because element selection is much simplified. I've tried running them on Chrome and you may run them in other browsers if you want to and see differences.