Function tag

  • This function can do the following based on the first argument:

    • create a tag if you provide a tag name: (div, abbr, custom-tag, ...),
    • wrap around an existing element in the page if you pass in a selector: ('(body)', '(#id)', '(.class)'), any selector is allowed.
    • wrap around an element passed in

    Then it can receive a list of children to be added. And receives a third argument for attaching this tag to the currently attach tag (attach)

    Parameters

    • arg0: string | HTMLElement
    • children: TagChildren = []
    • attach: boolean = false

    Returns CTag

    Example

    tag('div');
    tag('(body)');
    tag('(.someclass)');
    tag(document.querySelector('#something'));

Generated using TypeDoc