JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Tooltip create a tooltip template using jScript

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #108939
    edwardsmarkff
    Participant

    hello — i cannot determine how to create a template in javascript.

    https://codepen.io/edwardsmarkf/pen/dywrRBg

    the template created in the example as ordinary HTML works fine (tooltip_1), but when i attempt to create a new template in javascript (tooltip_2), it does not work.

    i can even toggle this line:

    tmpTooltip.setAttribute('tooltip-template', 'newTemplate_2'); // newTemplate_1 works!

    so i know everything is working except for the creation of the template.

    you can see in the chrome-console that my newly created template is identical to the one that htmlelements created just using ordinary HTML.

    please let me know what i have done wrong in my example

    thank you very much.

    #108947
    edwardsmarkff
    Participant

    scratch question please – i realized that even if i managed to get this to work, using the template is too limiting.   if you wanted to put in line breaks or other css, i dont think this would work.

    #108956

    Hi,

    When you create a template element js, you should put the children inside the content.
    Ex. tmpTemplate.content.appendChild(tmpDiv);

    Here is your demo now working: https://codepen.io/dkeamcaksoem/pen/abPMXqb

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.