Magic Icon New Form Fields (): Magic JavaScript

Quick Jump ↵

Creating new form fields on the fly

Usage

Add <script type="text/javascript" src="/PATH/TO/magic/tricks/new_form_fields/new_form_fields..js" charset="UTF-8"></script>

below your <script type="text/javascript" src="/PATH/TO/magic/wand..js" charset="UTF-8"></script>

Add data-mjf="new_form_fields|return_false" data-mjf_nff="tag:input|type:FIELD_TYPE|name:NEW_FIELD_NAME|parent:NEW_FIELD_PARENT_ID" id="ELEMENT_ID" to your <a> tag.

The required data-mjf_nff attributes are:

The optional data-mjf_nff attributes are:

Add <script type="text/javascript">$m.trick.new_form_field = true;</script> inside your <body> tag.

Use the examples below as a guide for building your own!

Examples

A label followed by a line-break, followed by an input=text followed by two line-breakscreate

Outputs → <label><br><input type="text"><br><br>

A label followed by an input=text followed by a line-breakcreate

Outputs → <label><input type="text"><br><br>

An input=checkbox followed by a label followed by a line-breakcreate

Outputs → <input type="checkbox"><label><br>

An input=radio followed by a label followed by two line-breakscreate

Outputs → <input type="radio"><label><br><br>

An input=file followed by a line-breakcreate

Outputs → <input type="file"><br>

A textarea followed by two line-breakscreate

Outputs → <textarea><br><br>

Notes

The order of the data-mjf_nff attributes is irrelevant.

Change Log

13.3.26

12.10.8

12.1.31

« Back to the main documentation