Multi stack Multi stack - 2 years ago 90
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
attribute of the label.

Answer Source

using its id plus Label selector

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



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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download