html - javascript function's parameter returning undefine -


function short_tag(tag, contents) {    return "<" + tag + ">" + contents + "</" + tag + ">";  }  document.getelementbyid("test-2").innerhtml = short_tag(p, okok);
<div id="test-2">    </div>

does know why error p not defined returning?

that's because p getting treated variable p should string. same okok

function short_tag(tag, contents) {  return "<" + tag + ">" + contents + "</" + tag + ">";  }  document.getelementbyid("test-2").innerhtml = short_tag("p", "okok");
<div id="test-2">    </div>


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -