Surya Prakash Tumma
Surya Prakash Tumma

Reputation: 2193

how to change label text in a div using jquery

I have a label in a div .

<div id="mydiv">
   <label>text</label>
</div>

how to write a selector to access the label and change the text .

Upvotes: 2

Views: 5230

Answers (1)

Milind Anantwar
Milind Anantwar

Reputation: 82241

Use:

$('#mydiv label').text('smtext');

Update: to change second label element in mydiv:

 $('#mydiv label:eq(1)').text('smtext');

Upvotes: 8

Related Questions