Moe Zecko
2006-Aug-02 00:30 UTC
[Rails] "RJS Error: TypeError: $(element) has no properties"
i have lots of divs, which are added via link_to_remote. now i want to delete them with a link_to_remote button for each. i am giving them ids with the same name and a serialized number. when trying to access them with javascript/rjs, strange things happen: "RJS Error: TypeError: $(element) has no properties?. is this a rails, rjs or prototype bug? or am i missing something? see my code below # i am rendering forms via partial collection <%= render :partial => "address/update", :collection => @person.addresses %> # the partial <div id=''addresslist<%= update.id %>''> <div id=''deletebutton''> [<%= link_to_remote ''x'', :url => {:controller => "address", :action => "destroy", :id => update.id} %>] </div> <%= form_remote_tag( :url => { :controller => "address", :action => "update" }, :html =>{:name => update.id}) %> <div id=''ls''><label for=''address_country''>Land</label></div> <%= text_field "address", "country", "size" => 30, :value => update.country %><br /> <br /> <%= submit_tag "Aktualisieren" %> <%= end_form_tag %> </div> # the controller def destroy Address.find(params[:id]).destroy return if request.xhr? # render RJS instead end # the RJS page.visual_effect :fade, ''addresslist''+params[:id], :duration => 1 page.replace_html ''adresslist''+params[:id], '''' thanks, m.zecko -- Posted via http://www.ruby-forum.com/.
Apparently Analagous Threads
- rjs error TypeError: element.getElementsByTagName is not a function in rails 3+jquery
- edge rails config.cache_classes = true breaks applications
- RJS Error: TypeError: while using active scaffold
- render partial collection passing property
- TypeError : transport.responseText has no properties