DOM Elements Creator 0.3

程序名称:DOM Elements Creator 0.3

授权协议: 未知

操作系统: 未知

开发语言:

DOM Elements Creator 0.3 介绍

What is it?

DOM Elements Creator is a simple plugin for creating DOM elements on-a-fly
which can be used as part of jQuery statements.

When you want to create new DOM element in pure jQuery you must use
document.createElement() method and then new element must be wrapped in
$() before it can be used in jQuery context. You can also use HTML code as a
selector to create a new object but this way requires writing HTML, which is
rarely comfortable. And you must also remember to espace any quotes.
This plugin provides more elegant way to achieve the same effect and requires
writting less code.

How to use it?

Just import plugin file after importing the jQuery library and you’re set.

Syntax:

$.create(element[, attributes[, children]])

Parameters:

  • string element - name of the element to create
  • object|array attributes - element properties to be set, you shouln’t use events attributes here such as onclick, onmouseover etc. since they won’t work
  • string|array children - child elements (could also contain text value)

Example:

  • JavaScript/jQuery approach:

var div = document.createElement('div'); $(div).attr('id', 'myId').text('myText').appendTo('#myElem');

  • standard jQuery approach:

$('<div>').attr('id', 'myId').text('myText').appendTo('#myElem');

or

$('<div id="myId">myText</div>').appendTo('#myElem');

  • plugin approach:

$.create('div', {'id': 'myId'}, 'myText').appendTo('#myElem');

Incompatible changes

0.3

Plugin function was renamed from $.new to $.create to fix issues on
Internet Explorer.

DOM Elements Creator 0.3 官网

http://plugins.jquery.com/project/DOMEC

相关编程语言

多功能下拉选择插件 SelectPage 简洁而强大的下拉分...
AutoComplete 是一个 jQuery Mobile 的插件,用于实...
Combogrid 是一个jQuery插件用于为输入框添加高级自...
Autobox2这个jQuery插件,可以用于创建类似于Facebo...
Link Scraper TextBox 是一个文本框的扩展插件,当你...
Awesomplete 超小超好用的超漂亮的 autocomplete 框...