0
0
mirror of https://github.com/Doodle3D/doodle3d-connect.git synced 2024-12-25 01:53:48 +01:00

autofocus password field

This commit is contained in:
peteruithoven 2014-05-08 22:40:08 +02:00
parent 2c9354dce9
commit 7b929a1506
3 changed files with 10 additions and 1 deletions

View File

@ -39,6 +39,9 @@
_form.attr("id","Join "+_pageData.ssid); _form.attr("id","Join "+_pageData.ssid);
_passwordField.val(""); _passwordField.val("");
_passwordCloneField.val(""); _passwordCloneField.val("");
});
$.mobile.document.on( "pageshow", PAGE_ID, function( event, data ) {
d3d.util.autofocus(_form);
}); });
$.mobile.document.on( "pagehide", PAGE_ID, function( event, data ) { $.mobile.document.on( "pagehide", PAGE_ID, function( event, data ) {
console.log(PAGE_ID+" pagehide"); console.log(PAGE_ID+" pagehide");

View File

@ -95,6 +95,12 @@ d3d.util = {
console.log("WARNING:"+warning); console.log("WARNING:"+warning);
return warning; return warning;
}; };
},
autofocus:function(form) {
if (!("autofocus" in document.createElement("input"))) {
var target = form.find("input[autofocus]:visible");
target.focus();
}
} }
}; };

View File

@ -142,7 +142,7 @@
<div role="main" class="ui-content"> <div role="main" class="ui-content">
<h3>Join a secured network</h3> <h3>Join a secured network</h3>
<form data-ajax="false" data-target="#connecting_to_network"> <form data-ajax="false" data-target="#connecting_to_network">
<input type="password" name="password" placeholder="Password" data-clear-btn="true" data-typetoggle='#showPassword' autocomplete="off"> <input type="password" name="password" placeholder="Password" data-clear-btn="true" data-typetoggle='#showPassword' autocomplete="off" autofocus>
<input id="showPassword" type="checkbox" value="showPassword"> <input id="showPassword" type="checkbox" value="showPassword">
<label for="showPassword" class="inline">show password</label> <label for="showPassword" class="inline">show password</label>
<input type=submit value="Connect"> <input type=submit value="Connect">