html - Javascript replaceChild -


i have line of html need change dynamically based on screen size. have javascript check screen size having trouble getting replace html need. need remove link tag , have text , divs styling. first line of code have, second need change to:

var smslink = document.getelementbyid("smstextlink");  var smstextnode = document.createtextnode('text agents available 8am - 10pm cst 7 days week');  smstextlink.parentnode.replacechild(smstextnode, smstextlink);
<a href="" id="smstextlink">text    <div style="color:#888888">agents available 8am - 10pm cst<br>7 days week</div>  </a>  text  <div style="color:#888888">agents available 8am - 10pm cst<br>7 days week</div>

you referencing

var smslink = document.getelementbyid("smslink"); 

but in html id="smstextlink"


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -