Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i have a label with title attribute.
HTML
<label id="lbl" title=@model.value>text</label>


Using Jquery i am trying to add/remove a class

C#
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.
}


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
Posted
Updated 17-Mar-15 10:21am
v2
Comments
Sergey Alexandrovich Kryukov 17-Mar-15 15:50pm    
This is not a problem at all. But where do you want to save this string? What should be the lifetime of this storage? (Until the page is updated? current session? lifetime of user's settings (local)? forever? even longer? :-)
—SA

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900