-3

I have a Html code like this:

<div class="form-group row">
     <label id="lb_size" class="col-lg-3 col-form-label">
          <span class="must-have">****</span>
          Size
     </label>
</div>

I want to using JQuery get purl text "Size" only .

I Try:

$("#lb_size").text()

result: "****Size"

Then I try:

$("#lb_size")[0].lastChild

result: "   Size   "

Finally, I use this code:

$($("#lb_size")[0].lastChild).text()

result: "Size"

It's work but it look dirty.

Have a better way to do this ?

Vic
  • 758
  • 2
  • 15
  • 31

1 Answers1

-2

you can you second solution though ... but you just have to add a little function before this. $.trim($("#lb_size")[0].lastChild) And you'll be able to get the output "Size" instead of
" Size "

Thanks Ans Happy Coding.