Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to display a div on input fields in jquery
    text
    copied!<p>i'm making a jquery form. Where i need to display a div only on those input fields where i click. (like tool tip.. but not exactly)... ya.. you can call it like datepicker... </p> <p>Thank you---- <strong>updated</strong> <br />Javascript:</p> <pre><code> &lt;script&gt; $(document).ready(function() { $('#months :input').click(function(){ xpos = $(this).css('left'); ypos = $(this).css('top'); var dateField = $(this); $('#calender').addClass('calender_visible'); var m = $('#calender .picker_month :selected').val(); var y = $('#calender .picker_year :selected').val(); $('#calender :button').click(function(){ dateField.val(m+'/'+y); $('#calender').removeClass('calender_visible'); }) }) }); &lt;/script&gt; </code></pre> <p>CSS: </p> <pre><code>&lt;style&gt; .calender_hidden{ display:none; } .calender_visible{ display:block; position:relative; background-color:#CCCCCC; width:120px; height:50px; } &lt;/style&gt; </code></pre> <p>Html:<br> </p> <pre><code> &lt;input name="month2" /&gt; &lt;input name="month3" /&gt; &lt;input name="month4" /&gt; &lt;input name="month5" /&gt; &lt;/div&gt; &lt;div id="calender" class="calender_hidden" &gt; &lt;select class="picker_month"&gt; &lt;option value="Jan"&gt;Jan&lt;/option&gt; &lt;option value="Feb"&gt;Feb&lt;/option&gt; &lt;option value="Mar"&gt;Mar&lt;/option&gt; &lt;option value="Apr"&gt;Apr&lt;/option&gt; &lt;/select&gt; &lt;select class="picker_year"&gt; &lt;option value="2001"&gt;2001&lt;/option&gt; &lt;option value="2002"&gt;2002&lt;/option&gt; &lt;option value="2003"&gt;2003&lt;/option&gt; &lt;option value="2004"&gt;2004&lt;/option&gt; &lt;/select&gt; &lt;input type="button" value="close" /&gt; &lt;/div&gt; </code></pre> <hr> <p>Now the question is... i want to display this small calender only on the div i select... but this doesn't appear under the object i clicked... how i reposition everytime when i click on input fields.</p>
 

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