How to hide label on input-focus with JQuery? -


i trying hide label when click inside input field, doesn't work , cant figure out why on own.

i tried modify example suit needs without luck.: http://blog.stannard.net.au/2011/01/07/creating-a-form-with-labels-inside-text-fields-using-jquery/

please simple possible, no nifty tricks needed here.

my code: html:

fieldset id="fieldset1">     <dl>         <dt class="jform_name">             <label id="jform_name-lbl" class=" required" for="jform_name">wer sind sie:</label>         </dt>         <dd class="jform_name">             <input id="jform_name" class="required" type="text" aria-required="true" required="required" size="37" value="" name="jform[name]">         </dd>     </dl> </fieldset> 

here jquery:

<script type="text/javascript"> $('input#jform_name').focus(function(){     $('label#jform_name-lbl').hide(); }); </script> 

you aren't including jquery in html posted, , although it's possible haven't included full html (please in future), think still worth mentioning seem new.

you'll need in html, preferably @ bottom, above </body> tag.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 

otherwise, adrift mentioned, displayed code fine: http://jsfiddle.net/4lzv7/


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -