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

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -