如何保存标签标题属性 [英] How to save label title attribute

查看:63
本文介绍了如何保存标签标题属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i有一个带title属性的标签。

Hi,
i have a label with title attribute.

<label id="lbl" title=@model.value>text</label>





使用Jquery我正在尝试添加/删除一个类





Using Jquery i am trying to add/remove a class

if(true)
{
   $('lbl').removeclass(cls).removeAttr('title');
   //This will remove the title
}
else
{
    $('lbl').addclass(cls);
   I want the title to display in this condition.
}





我不能在jquery中给出标题文本,但需要保留html中给出的标题。我怎么能这样做?

请帮助



I can not give title text in jquery , But need to preserve the title which is given in the html.How can i do that??
Please help

推荐答案

' lbl')。removeclass(cls).removeAttr(' 标题');
// 这将删除标题
}
else
{
('lbl').removeclass(cls).removeAttr('title'); //This will remove the title } else {


' LBL')addclass(CLS);
我希望标题在条件中显示
}
('lbl').addclass(cls); I want the title to display in this condition. }





我不能在jquery中给出标题文本,但需要保留html中给出的标题。我怎么能这样做?

请帮助



I can not give title text in jquery , But need to preserve the title which is given in the html.How can i do that??
Please help


在页面加载时,你可能想要将它保存到一个小容器,如HiddenField或ViewState的;或者您可以使用JavaScipt OnLoad中的值执行某些操作。
On the page load, you'll probably want to save it to a small container such as a HiddenField or ViewState; or you could do something with the value it in JavaScipt OnLoad.


这篇关于如何保存标签标题属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆