Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found the JavaScript to be too complicated and hard to follow. So let us simply it:</p> <pre><code>$(document).ready(function() { $('.container').on('focus', 'input.trigger', function(e) { var input = $(this); var position = input.position(); $("#popup") .data('target', $(e.target)) .css('top', position.top + 24) .css('left', position.left + 20) .show(); }); $('.clear').on('click', function(e) { e.preventDefault(); var input = $(e.target).closest('#popup').data('target'); input.val(''); $(e.target).closest('#popup').hide(); }); $('.revert').on('click', function(e) { e.preventDefault(); $(e.target).closest('#popup').hide(); }); $('.close').on('click', function(e) { e.preventDefault(); $(e.target).closest('#popup').hide(); }); });​ </code></pre> <p>And here is a working example of this simpler approach: <a href="http://jsfiddle.net/UZ4QM/" rel="nofollow">http://jsfiddle.net/UZ4QM/</a></p> <h1>Adding back the bling</h1> <p>Now we can add the bling back:</p> <pre><code>$(document).ready(function() { $('.container') .on('focus', 'input.trigger', function(e) { var input = $(this); var position = input.position(); $("#popup") .data('target', $(e.target)) .css({'top': position.top + 24, 'left': position.left + 20 }) .show('slow'); }) .on('blur', 'input.trigger', function(e) { $("#popup").hide(); }); $('.clear').on('click', function(e) { e.preventDefault(); var input = $(e.target).closest('#popup').data('target'); input.val(''); $(e.target).closest('#popup').hide(); }); $('.revert').on('click', function(e) { e.preventDefault(); $(e.target).closest('#popup').hide(); }); $('.close').on('click', function(e) { e.preventDefault(); $(e.target).closest('#popup').hide(); }); });​ </code></pre> <p>And here is a working example of it blinged up closer to the original: <a href="http://jsfiddle.net/C9JM5/" rel="nofollow">http://jsfiddle.net/C9JM5/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload