Skip to content

Instantly share code, notes, and snippets.

@DiegoVallely
Forked from nappa7878/focus.js
Created February 6, 2013 03:28
Show Gist options
  • Save DiegoVallely/4719997 to your computer and use it in GitHub Desktop.
Save DiegoVallely/4719997 to your computer and use it in GitHub Desktop.
function onoffSelect_focus(obj){
var userAgent = window.navigator.userAgent.toLowerCase();
if(userAgent.indexOf("msie") > -1) {
obj.focus();
obj.select();
}else if(userAgent.indexOf("firefox") > -1) {
obj.focus();
obj.select();
}else if(userAgent.indexOf("opera") > -1) {
obj.focus();
obj.select();
}
}
function onoffSelect_click(obj){
var userAgent = window.navigator.userAgent.toLowerCase();
if(userAgent.indexOf("chrome") > -1) {
obj.focus();
obj.select();
}else if(userAgent.indexOf("safari") > -1) {
obj.focus();
obj.select();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment