Ben Aston
Ben Aston

Reputation: 55759

Javascript library for rendering HTML form elements

Does anyone know of a JavaScript library for rendering form elements? For example for a select element, I'd like to be able supply classes, an id and an array of items for rendering into an html select element.

Upvotes: 0

Views: 1300

Answers (3)

Goje87
Goje87

Reputation: 2869

You can try javascript UI libraries like Jquery Tools, Jquery UI.

Upvotes: 1

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114417

I started working on a system that build forms based on JSON data automatically. You're welcome to go steal the code.

P.S. it was a loooong time ago.

Upvotes: 1

pimvdb
pimvdb

Reputation: 154908

I'm not sure if you want a library that really draws things itself, but reading between the lines I think you just want to build HTML elements yourself. In that case, you could use jQuery. It can be as easy as:

$("<select>")
  .append(
    $("<option>").text("first"),
    $("<option>").text("second"),
    $("<option>").text("third")
  )
  .addClass("class1 class2")
  .attr("id", "someid")
  .appendTo("body");

Upvotes: 1

Related Questions