Смена класса элемента
function change(id, newClass) { identity=document.getElementById(id); identity.className=newClass; }
TextSnippets > xtrim > dom
2581 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
function change(id, newClass) { identity=document.getElementById(id); identity.className=newClass; }
class ActiveRecord::Base def dom_id(prefix=nil) display_id = new_record? ? "new" : id prefix ||= self.class.name.underscore prefix != :bare ? "#{prefix.to_s.dasherize}-#{display_id}" : display_id end endSo, you can do stuff like this in your views: <ul> <% @entries.each do |entry| %>> <%= entry.body %> <% end %> And stuff like this in your controller: def remove_entry entry = JournalEntry.find(params[:id]) update_page do |page| page[entry.dom_id].remove end end