2012-03-21 36 views
0

我的HTML:
無法處理 「稱號」 HTML控件的屬性

<input id="Text2" type="text" title="nepal" name="text" /> 

當我運行this.My了看跌期權:
enter image description here

在實際項目中title ATTR持有小鬼的ID即應很難改變。我只是想刪除工具提示部分意味着不想顯示nepal這是顯示來自title屬性。我搜索了很多,但無法處理它。任何建議。謝謝。

+0

「應該難以改變的身份證」是什麼意思?請詳細說明您的問題..很明顯,title屬性給出了工具提示.. – gout 2012-03-21 05:15:29

回答

0

只要鼠標懸停在上面,就可以通過刪除屬性來防止出現工具提示。這在jQuery中很容易實現。

var titleAttribute; 

$('#Text2').hover(function() { 
    titleAttribute = $(this).attr("title"); 
    $(this).attr("title", ""); 
}, function() { 
    $(this).attr("title", titleAttribute); 
}); 
+0

非常感謝。您遇到了我真正的問題並給我一個正確的解決方案。謝謝了很多。 – 2012-03-21 05:32:49

2

您不應爲自己的使用而徵用內置屬性。標題屬性是使該工具提示出現的原因。擺脫它,而是,使用custom data attribute

<input id="Text2" type="text" data-imp-id="nepal" name="text" /> 
0

拆卸工具提示:刪除title屬性和工具提示不會出現。你也可以使用rel屬性。