js parse html code example

Example 1: html parser javascript

var parser = new DOMParser();
var htmlDoc = parser.parseFromString(txt, 'text/html');
htmlDoc.getElementById("someID");

Example 2: notify html

UIkit.notify({
    message : 'Bazinga!',
    status  : 'primary',
    timeout : 5000,
    pos     : 'top-center'
});


// Shortcuts
UIkit.notify('My message');
UIkit.notify('My message', status);
UIkit.notify('My message', { /* options */ });

Example 3: html add page to document

<nav>
  <ul>
    <li><a href="myPage.html">Main Page</a></li> <!-- Add a link to a website. -->
    <li><a href="myOtherPage.html">Other Page</a></li> <!-- Add a link to another website. -->
  </ul>
</nav>

Tags:

Html Example