Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Fixes #1459 — Clicking on a search input’s “clear” button now returns…
Browse files Browse the repository at this point in the history
… focus to the search input.
  • Loading branch information
Wilto committed Mar 3, 2012
1 parent f0acc75 commit cbe4320
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/jquery.mobile.forms.textinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ $.widget( "mobile.textinput", $.mobile.widget, {

focusedEl = input.wrap( "<div class='ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield" + themeclass + miniclass + "'></div>" ).parent();
clearbtn = $( "<a href='#' class='ui-input-clear' title='clear text'>clear text</a>" )
.tap(function( event ) {
input.val( "" ).focus();
input.trigger( "change" );
.bind('click', function( event ) {
input
.val( "" )
.focus()
.trigger( "change" );
clearbtn.addClass( "ui-input-clear-hidden" );
event.preventDefault();
})
Expand Down

0 comments on commit cbe4320

Please sign in to comment.