javascript - How to dymanic change html tags? -
is possible in angularjs/jquery/javascript?
<div ng-init="font='h2'"> <h1> h1 size </h1> <{{font}}> {{font}}</{{font}}> </div>
how dymanic change html tags? thank in advance.
ps: try code, no success.
here's plain javascript solution:
var i=0; setinterval(function() { document.getelementbyid("changeable").outerhtml = "<h" + (i+1) + " id=\"changeable\">" + document.getelementbyid("changeable").innerhtml + "</h" + (i+1) + ">"; i++; if(i>=5){ i=0; } },1000);
<div> <h1> h1 size </h1> <h2 id="changeable"> header tag</h2> </div>
Comments
Post a Comment