SSW Foursquare

Do You Help Users By Selecting A Default Field

Last updated by Tom Bui [SSW] 6 months ago.See history

Help your users by setting the default field when your MVC Website loads.

By selecting a default field for your users when a page loads you can improve the usability of your website by reducing the amount of steps needed to perform a task.

Here is a way to do this with MVC 3 and Razor:

1. Add a div with a class around the field you want to set focus on

<div class="focus">
    @Html.EditorFor(model => model.FirstName)
    @Html.ValidationMessageFor(model => model.FirstName)
  1. Then use jQuery to select the class and set focus:

    $(function() {
    $('.focus :input').focus();
We open source. Powered by GitHub