DOM Elements Creator

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-14 22:57:24

软件介绍

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.

本文地址:https://www.codercto.com/soft/d/23400.html

微信营销与运营

微信营销与运营

王易 / 机械工业出版社 / 2014-1-1 / CNY 49.00

这是一本深度介绍微信营销的书,也是一本系统讲解微信公众账号运营的书,它基于微信的最新版本,从策略、方法、技巧与实践等多角度详细解析了微信的营销与运营,所有内容都是行业经验的结晶,旨在为企业运用微信提供有价值的参考。 本书首先从商业模式角度全面分析了微信5.0推出的“扫一扫”、表情商店、微信游戏、微信支付等新功能背后的商业机会,以及订阅号折叠给企业带来的影响和应对策略;其次从运营角度系统归纳了......一起来看看 《微信营销与运营》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具