Passing div class to javascript function as argument -
sorry quick question. starting code in javascript , wondering if there way following. pass name of div class argument javascript function. possible pass name of div string , use string div class within javascript function or there way it?
thanks!
without knowing you're trying class, guess want add div.
html:
<div id="mydiv"></div> js:
var somefunc = function (classtoadd, id) { // awesome stuff document.getelementbyid(id).classname = classtoadd; }; somefunc('someclass', 'mydiv');
Comments
Post a Comment