Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery - Change text from label

Tags:

this is the label, having text = Use 20 kms

using jquery i want to Replace the text "20 Kms" with 10 kms"

I get the hand to label like this

 $("label[for='applyDistanceSlab']");

how can i do that...

like image 818
maaz Avatar asked Mar 21 '12 11:03

maaz


People also ask

How to change the text of a label using jQuery?

You can also use the jQuery html() method to change the text of a label. If I want to change the text inside the label from “First Name:” to “Name:”, I can use the jQuery text() method to do this with the following Javascript code. We can also use the jQuery html() method to change the content of a span.


2 Answers

$("label[for='applyDistanceSlab']").text("10 kms");
like image 195
Curtis Avatar answered Sep 17 '22 15:09

Curtis


$("label[for='applyDistanceSlab']").text('use 10 kms');

LIVE DEMO

text:

Description: Get the combined text contents of each element in the set of matched elements, including their descendants.

like image 21
gdoron is supporting Monica Avatar answered Sep 20 '22 15:09

gdoron is supporting Monica