<p class="postal">
<label contenteditable="true" class="tabValue">post code</label>
<label contenteditable="true" class="tabValue">post code</label>
</p>
$(document).ready(function() {
$('.tabValue').change(function() {
console.log(this.innerText);
});
});
我一直在尝试使用这个核心,但无法将更改文本值发送到控制台。 请访问此链接获取示例:http://jsfiddle.net/wqje0x6s/2/
最佳答案
在jquery中使用.text()
$(document).ready(function() {
$('#tabValue').focusout(function() {
console.log($(this).text());
});
});
关于javascript - 如何获取标签的文本变化值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29668749/