如何使用 for 获取标签的文本
How to get text of a label using for
如何通过 for
选择器获取标签的文本?这是我的标签:
<label for="startdate">Iteration Start</label>
这是我试过的方法:
$("label[for='startdate']").text();
但是这个returns“”。
有人可以帮忙吗?
提前致谢!
alert($('label[for=startdate]').text())
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label for="startdate">Iteration Start</label>
Description: Selects elements that have the specified attribute with a value exactly equal to a certain value.
如何通过 for
选择器获取标签的文本?这是我的标签:
<label for="startdate">Iteration Start</label>
这是我试过的方法:
$("label[for='startdate']").text();
但是这个returns“”。
有人可以帮忙吗?
提前致谢!
alert($('label[for=startdate]').text())
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label for="startdate">Iteration Start</label>
Description: Selects elements that have the specified attribute with a value exactly equal to a certain value.