1.0.7 • Published 6 years ago

html-to-str v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

HTMLPARSER

Usage

npm install html-to-str -s

Import the script, and link to your HTML

        <script src="PATH/htmlparser.js"></script>

Or import the CDN to your html

<head>
  <script src="https://cdn.jsdelivr.net/npm/html-to-str@1.0.7/index.js"></script>
</head>

In your script.js, call the class and it's static method:

alert(HTMLParser.assign("notification", (document.getElementById('test').innerHTML.toString())));

OR

var notification = HTMLParser.stringify((document.getElementById('teste').innerHTML.toString()));

Input

<div class="card small hoverable" id="test">
          <div class="card-image waves-effect waves-block waves-light">
          </div>
          <div class='card-content'>
            <div class='row'>
              <p class='flow-text center'>Testing</p>
              <br/>
              <div class="col s12 center">
                <button class="btn activator" onclick="login()">Login</button>
              </div>
              <br/>
            </div>
          </div>
          <div class="card-action">
            <div class="col s12">
            </div>
          </div>
          <div class="card-reveal" id="reveal-content">
          </div>
</div>

Output

var notification = '<div class="card-image waves-effect waves-block waves-light"></div><div class="card-content"><div class="row"><p class="flow-text center"></p><br><div class="col s12 center"><button class="btn activator" onclick="login()"></button></div><br></div></div><div class="card-action"><div class="col s12"></div></div><div class="card-reveal" id="reveal-content"></div>'

Edison Cury

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago