在jquery中读取Label的值

I am trying to set and read value of a lable in jquery but it returns empty

$('label#ringIdLabel').text(jQuery(this).val());

It shows label text as xx

but when retrieving with

     var ringId = $("#ringIdLabel").val();

it turns out to be empty. My lable is defined as

        <label  id="ringIdLabel" style="visibility: hidden;"   ><?php echo $mainRing['id'] ?></label>

To retrieve you need to use text() function only

var ringId = $("#ringIdLabel").text();

Here is the working Fiddle.

You can't use val() for label because val() looks for value attribute of the tag and label doesn't have one

Try this

var ringId = $("#ringIdLabel").text();

DEMO

Getting Label Value

var x=$("#ringIdLabel").html();
alert(x);

Setting Label Value

$("#ringIdLabel").html("PhotoShop");