rjs error TypeError: element.getElementsByTagName is not a function in rails 3+jquery

hi,

    i am using rails 3.0.10 i am trying with sample application for searching data from table and updating my search.html.erb file is <%= form_for (@employee) do |s|%

<div id ="search_details"> <%= s.text_field :name%> <%= s.text_field :emp_id, :onfocus => 'sal(document.getElementById('employee_name').value);'%> </div> <% end %>

when i click tab it calls sal() jquery function and i sent the data to action, in action parameter is processed well, but while replacing div with partial page i am getting following error like

RJS error:

TypeError: element.getElementsByTagName is not a function

Element.update("upc_search", "\n \n <div >\n <table border = \"1\">\n <tr>\n <th>\n <label >No</label> \n <br />\n <input tyep=\"text\" value=\"1\" size=\"30\"/>\n </th>\n <th>\n <label for= \"id\" >id</label>\n <br />\n <input tyep=\"text \" value=\"0123456789123\" size=\"30\" />\n </th>\n <th>\n <label for=\"Name\" >Name</label>\n <br /> \n <input tyep=\"text\" value=\"Lotion\" size=\"30\" />\n </

\n </tr>\n </table>\n </div>\n\n <br />\n \n");

i used https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js, https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.js for jquery process

could any one provide me solution ?

thanks, -pab

You probably should't use prototype methods when you've chosen jquery as your js framework.

Exactly what it says: getElementsByTagName is a basic JavaScript function of *document*. So you need to look at your JS to see where that's getting muddled...

Hassan Schroeder wrote in post #1021992:

Perhaps you could be a little more explicit about what part of that you consider to be "wrong" ? :slight_smile:

Hi,

    how to avoid using prototype method ?

thanks, -pab