I have a anchor tag which I would like to disable or enable depending upon some condition. I am able to achive this using the following function
function disableEnableAnchor(obj, disable) {
if(disable)
{
var href = obj.getAttribute("href");
if(href && href != "" && href != null)
obj.setAttribute('href_bak', href);
obj.removeAttribute('href');
}
else {
var href_bak = obj.attributes['href_bak'].nodeValue;
obj.setAttribute('href', href_bak);
}
}
But I am not able to remove the underline when the anchor is in a disabled state . How should I achieve this inside this function ? Help !