The blog has moved to the new site F10Debug.com

Thursday, November 2, 2017

Set Span value using Jquery

Using jQuery to set value on SPAN element

Let say we have below span element,
<Span id="spnTest" class="red"></span>
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");

No comments:

Post a Comment