【发布时间】:2011-10-01 01:11:26
【问题描述】:
我正在尝试使用 jquery 制作一个显示/隐藏按钮,并且我还希望在将鼠标悬停在按钮上时更改工具提示/标题,但它根本不起作用。
我的代码可以在这里找到:
【问题讨论】:
标签: javascript jquery button tooltip
我正在尝试使用 jquery 制作一个显示/隐藏按钮,并且我还希望在将鼠标悬停在按钮上时更改工具提示/标题,但它根本不起作用。
我的代码可以在这里找到:
【问题讨论】:
标签: javascript jquery button tooltip
HTML:
<input id="button" type='button' value='Not Clicked' title = 'Not Clicked'>
Javascript:
$('#button').click(function() {
if ($(this).val() == "Not Clicked")
{
$(this).val("Clicked");
$(this).attr("title", "Clicked");
}
else
{
$(this).val("Not Clicked");
$(this).attr("title", "Not Clicked");
}
});
【讨论】:
.text() 文档页面上准确地说:The .text() method cannot be used on input elements. For input field text, use the .val() method.