Magic Icon Fire Any Event: Magic JavaScript

Quick Jump ↵

Usage

First add data-mjf="fire_event|return_false" id="ELEMENT_ID" to your clickable tag.

Next there are three attributes to determine…

  1. data-mjf_fe_on="click(OR)mousedown(OR)etc" — event that triggers the Fire Event
  2. data-mjf_fe_exe="focus(OR)blur(OR)etc" — the actual event to fire
  3. data-mjf_fe_id="ELEMENT_ID_TO_FIRE_ON" — the element id to act on

Finally add <script type="text/javascript">$m.wand.fire_event = true;</script> inside your <body> tag.

Examples

Focus Field

<a href="#" data-mjf="fire_event|return_false" data-mjf_fe_on="click" data-mjf_fe_exe="focus" data-mjf_fe_id="testing_input" id="focus_link">Focus Field</a>
<input type="text" name="" value="" id="testing_input">

Focus Field after Light Switch

<a href="#" data-mjf="lightswitch|fire_event|return_false" data-mjf_lswitch_id="focus_link_cont" data-mjf_fe_on="click" data-mjf_fe_exe="focus" data-mjf_fe_id="testing_input2" id="focus_link2">Focus Field after Light Switch</a>
<span class="display_none" id="focus_link_cont"><input type="text" name="" value="" id="testing_input2"></span>

« Back to the main documentation