How can i add underline to a textString which comes/changes dynamically as am using xml-jquery

212 Views Asked by At

i wanted the XML attributes values which comes on page using Jquery should get underline at specific Character.

can any one please help me on this.?

Thank you in advance.

$(menuGroup).append('<a href="#" id="'+menuGroupName+'" onclick="SearchByDE(this.id)" title="'+menuTooltipNote+'" accesskey="'+menuAccessKey+'" class="hasSubMenu left_nav_menu">'+'<p style="padding-top:6px;">'+menuGroupName+'</p>'+'</a>');
1

There are 1 best solutions below

7
On

CSS:

.accesskey { text-decoration: underline; }

JS:

var accessIndex = menuGroupName.indexOf(menuAccessKey);
menuID = menuGroupName;
if (accessIndex !== null) {
    menuGroupName = menuGroupName.substr(0, accessIndex-1) + '<span class="accesskey">' +
                    menuAccessKey + '</span>' + menuGroupName.substr(accessIndex+1);
}
$(menuGroup).append('<a href="#" id="'+menuID+'" onclick="SearchByDE(this.id)" title="'+menuTooltipNote+'" accesskey="'+menuAccessKey+'" class="hasSubMenu left_nav_menu">'+'<p style="padding-top:6px;">'+menuGroupName+'</p>'+'</a>');

I still don't see any dependency on XML in this. Maybe the menu data comes from XML, but I don't see how that matters for the formatting.