View on GitHub

jQuery-eGen

jQuery plugin, "eGen"

ダウンロード : .zip 形式 ダウンロード : tar.gz 形式

Home, Examples,   Japanese home

jQuery-eGen plugin

これはクエリー文字列からHTML要素を生成するjQueryプラグインです。

インストール

jQueryを読み込むscriptタグの後にeGenを読み込んでください。

<script src="your/js/path/jquery.min.js"></script>
<script src="your/js/path/jquery.egen.min.js"></script>

もしくは、スクリプトをパッケージに取り込んでください。

使い方

最も単純なdivタグを生成する例

div = $.egen()

idとclassを指定したiタグを生成する例

icon = $.egen('i.fa.fa-spinner.fa-spin#waitIcon');

中央揃えのpタグを生成し、bodyタグに加える例

$('body').egen('p', { align: 'center' }, 'welcome to eGen!');

入れ子構造になった要素を一度で生成する例

warnText = $.egen('p.warn b i', { align: 'center' }, 'Bold and Italic');

動作サンプルも見てみましょう。

ライセンス

Copyright (c) 2015 SabaMotto

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

作者

SabaMotto
GitHub: sabamotto Twitter: @sabamotto