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

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -