Multi stack Multi stack - 7 months ago 9
Javascript Question

How to get label by Id in jquery

I have the following label:

<label id="TWCv6" style="display:none">TWC</label>


I want to access it using its id plus Label selector to set its css. How can I do it?

Something like
$('label .TWCv6')
. Also I don't want to access using
For
attribute of the label.

Answer

using its id plus Label selector

You need to prefix # when using ID Selector (“#id”)

Use

$('label#TWCv6')

Note: As Identifiers in HTML Must be unique. only $('#TWCv6') should work

Comments