/SFDynamicHTML

Dynamically change content of a html on the client-side

Primary LanguageJavaScriptMIT LicenseMIT

Written by Software License

SFDynamicHTML

SFDynamicHTML is a library that allow you to dynamically load HTML content from client-side/browser.

This library was useful to lazily change DOM content.

Sample Usage

<div class="user-list">
    <user id="1">
        <a part="href">
            <img part="src">
            <span part="html"></span>
        </a>
    </user>

    <user id="2">
        <a part="href">
            <img part="src">
            <span part="html"></span>
        </a>
    </user>

    <user id="1">
        <a part="href">Visit first user</a>
    </user>
</div>

<script>
    SFDynamicHTML('user', {
        1:{
            html:"First",
            src:"https://upload.wikimedia.org/wikipedia/en/9/95/Test_image.jpg",
            href:"https://en.wikipedia.org/wiki/File:Test_image.jpg"
        },
        2:{
            html:"Second",
            src:"https://upload.wikimedia.org/wikipedia/en/9/95/Test_image.jpg",
            href:"https://en.wikipedia.org/wiki/File:Test_image.jpg"
        }
    }, document.querySelector('.user-list') || false)
</script>

Contribution

If you want to help in SFDynamicHTML library Please fork this project and edit on your repository, then make a pull request to here.

Keep the code simple and clear.

License

SFDynamicHTML is under the MIT license. But don't forget to put the a link to this repository.