comparison js/modules/app.js @ 62:68b4c80e884f

focus on first input element of newly opened dialogs
author Atul Varma <avarma@mozilla.com>
date Sun, 25 Apr 2010 08:14:18 -0700
parents 07d3d1560b93
children 88b856b1353b
comparison
equal deleted inserted replaced
61:0e50d4f77a77 62:68b4c80e884f
178 function openDialog(event) { 178 function openDialog(event) {
179 var name = this.getAttribute("data-dialog"); 179 var name = this.getAttribute("data-dialog");
180 var dialog = $("#" + name); 180 var dialog = $("#" + name);
181 if (dialog.length == 0) 181 if (dialog.length == 0)
182 throw new Error("dialog not found: " + name); 182 throw new Error("dialog not found: " + name);
183 dialog.fadeIn(); 183 dialog.fadeIn(
184 function() {
185 dialog.find("input:first").focus();
186 });
184 }); 187 });
185 188
186 $(".dialog").click( 189 $(".dialog").click(
187 function dismissDialogOnOutsideClick(event) { 190 function dismissDialogOnOutsideClick(event) {
188 if (event.target == this) 191 if (event.target == this)