how to set a text for span using JQuery

By | November 4, 2017

how to set a text for span using JQuery

Let say we have below span element,


You can set value of span element using two ways,

1) By Using Class name of Span

$(".red").text("Hello");

$(".red").html("Hello");

2) By Using Id of Span

$("#spnTest").text("Hello");

$("#spnTest").html("Hello");

Learn more jquery tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *