jquery

April 27th, 2011 by usage | Filed under JavaScript, Programming

How to set focus on first visible input box

<script type="text/javascript">
jQuery(document).ready(function($) {
   $("input:text:visible:first").focus();
})
</script>

If you have embed code the code below selects the text when the user clicks on the textarea.
Also the text area is readonly so the user can’t accidentally delete or cut fewer characters.

<script type="text/javascript">
jQuery(document).ready(function($) {
   $(".embed_code").click(function() {
		$(this).select();
   }).attr('readonly', 'readonly');
})
</script>

Usage:

<textarea class="embed_code">Your embed code goes here ...</textarea>

tag_iconTags:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a comment.

To leave a comment, please fill in the fields below.