skillberto / jqueryform
This JavaScript file create HTML DOM with jQuery.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- components/jquery: dev-master
This package is not auto-updated.
Last update: 2024-12-16 13:07:53 UTC
README
Now, find some fancy methods:
appendElement, prependElement, insertElement, createElement.
The appendElement
inserts content, specified by the parameter, to the end of each element in the set of matched elements.
The prependElement
inserts content into the beginning, and insertElement
removes everything, and puts the new content into the parent element.
The last function createElement
is the core of the other ones. These methods create a new jQuery instance from the parameters.
All of this need: parent, properties
parameters.
First parameter: parent
.
Type: string (jQuery selector) or object of jQuery instance.
For example: div#box
.
Second parameter: properties
.
Type: object
Element property is rendered for HTML DOM tag, this is necessary.
Value is the property for content/value.
All of others rendered into method .attr like $(element).attr(properties)
.
In this example, the content (Jee, it's....) will be in the div, what use '#box' id:
new jQueryForm().insertElement('div#box', {element: 'input', id: '#box_1', value: "Jee, it's a pretty content"});
Every function returns with the core object, so more implementation is easy:
new jQueryForm()
.insertElement('div#box', {"element": "input", "type": "text", "value": 5})
.appendElement('div#box', {"element": "input", "type": "password", "id": "name", "value": 6, "name": "password"});
If you want, you can change the return value with getJquery
method. If this true
, the methods return with jQuery instance, else with the jQueryForm instance.