enavu webdevmania tutsvalley psdestination
visit the enavu network
One Comment Article Title Overlay Article Title

Automatic input field focus on page load

Sometimes you want an input field to be selected by default(automaticaly selected). Like when you go to google the search input field is automaticaly selected. We will do this in today’s daily tip using jQuery.

DZoneDiggDesign FloatDeliciousBlinklistRedditFacebookGoogle BuzzTwitterStumbleUponTumblrShare

Demo(styled)     Source

HTML

<input type='text' id='default_input' />

jQuery

$(document).ready(function() {

	$('#default_input').focus();

});

Easy as that :)

Related posts:

  1. jQuery focus on first field trick
  2. Description text inside an input field
  3. Use HTML5 Placeholder Input Attribute Today using jQuery!
  4. Daily Tip : Difference between $(document).ready and $(window).load in jQuery
  5. Using multiple versions of jQuery on the same page

Slobodan Kustrimovic

This author has yet to fill his BIO.

Did you absolutely LOVE this article... share it!

Comments

Leave your own!

Sponsors

freedcamp free project management

Popular Articles

fzilla file hosting