“Changing the class of a div using rails NOT JS”
December 9, 2008 at 4:01 pm Leave a comment
Consider we need to change the class of a particular DIV/SPAN , I was wondering how we could have done using some default rails method and NOT Javascript as what we can do in Javascript the same we can do using Rails but in lesser time and number of lines of code.
Using google with the correct key words resulted in the following
Javascript
function change(id, newclass)
{
identity=document.getElementById(id);
identity.className=newclass;
}
Rails
page["task_#{params[:id]}”].toggle_class_name “completed”
Entry filed under: javascript, mumbai, rails, videos. Tags: javascript, rails.
Trackback this post | Subscribe to the comments via RSS Feed