Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3222310
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:58:34+00:00 2026-05-17T15:58:34+00:00

I have generated the code for a select & its objects using Rails: var

  • 0

I have generated the code for a select & its objects using Rails:

var insert_tag = '<select class="select medium" id="category_id" name="search[category_id]"><option value="-1">Select Category</option>
<option value="1">Boats and Cruisers</option>
<option value="2">Car Parts and Spares</option>
<option value="3">Caravans</option>
<option value="4">Coaches and Buses</option>
<option value="5">Commercial Parts</option>
<option value="6">Commercials</option>
<option value="7">Crash Repair Services</option></select>';

I have on JavaScript function which when called should insert this field into a blank div:

<div "form_field_a"></div>


$("form_field_a").insert(insert_tag);

But when this runs I just get this error:

content.toElement is not a function
[Break on this error] if (content && content.toElement) content = content.toElement(); 

I am new to JavaScript and have no idea why this does not work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:58:35+00:00Added an answer on May 17, 2026 at 3:58 pm

    I don’t know Prototype, but your div element is missing an id attribute (currently it is invalid HTML):

    <div id="form_field_a"></div>
    

    Then it seems to work: http://jsfiddle.net/KqVdf/1

    Also note that the value of insert_tag is one line without line breaks (got an error otherwise).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a task and I want to generate some code using the CodeDom.
We have a project that generates a code snippet that can be used on
I have some code that generates image of a pie chart. It's a general
I have some very simple code to generate an assembly and invoke a method
I have some JS code which generates the following object, return { type: some
Presently I have a some legacy code, which generates the op code. If the
I have this php code, with which I am trying to generate a popup
I'm updating my code generator and have a choice between implementing a method stub
I have a generated HTML page with flash content in it. I am trying
I have a generated txt file. This file has certain lines that are superfluous,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.