Adding a custom attribute to an HTML element

3 posts, 0 answers
  1. Mark
    Mark avatar
    6 posts
    Member since:
    Apr 2011

    Posted 03 Aug 2011 Link to this post

    Is there a simple way to add a custom attribute to a selected HTML element?

    For example, I want to add an ID attribute to H1 tag for use with an anchor link.  I was using standard anchor tags, but the issue is that they are not visible in edit mode.  It makes working with anchors for non-HTML savvy people very hard.

    Any ideas would be greatly appreciated.
  2. Rumen
    Admin
    Rumen avatar
    14028 posts

    Posted 04 Aug 2011 Link to this post

    Hi Mark,

    You can visualize the anchors in the content area using the following KB article:
    http://www.telerik.com/support/kb/aspnet-ajax/editor/making-named-anchors-visible-in-editing-area.aspx

    Regards,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Mark
    Mark avatar
    6 posts
    Member since:
    Apr 2011

    Posted 05 Aug 2011 Link to this post

    I tried implementing the functionality outlined in the post, but I had some issues.  I am delivering the editor from an assembly and I cant seem to register the script block at the right time.  I also tried putting the JS in the resource file I am already including from the assembly with no luck.

    I figured out a work around where I am wrapping the anchor tags around text and applying a CSS class to hide the hyperlink appearance that is applied with an anchor tag, even if an href attribute isn't present.

    Thanks for the response.
    Mark
Back to Top