JQuery获得了一个按钮的标题 [英] JQuery get the title of a button
本文介绍了JQuery获得了一个按钮的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个按钮:
<button type="button" onclick="toggleColor('white');" >White</button>
这使得:
有什么方法可以得到什么使用jQuery写在按钮上。例如,此按钮将返回白色
,因为它位于2个按钮标签之间。
Is there any way to get what is written on the button using jQuery. For example this button would return White
because its in-between the 2 button tags.
推荐答案
你可以使用 .text()
,
$('button').text();
请阅读在这里了解更多信息。
这篇关于JQuery获得了一个按钮的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文