开发者

do not highlight input value when tabbing over

开发者 https://www.devze.com 2022-12-22 16:05 出处:网络
This is a 2 part question: 1) click on one of the demo dropdowns on this page. when you tab over to the next input, the text is selected/highlighted in firefox. how can i preve开发者_如何学编程nt thi

This is a 2 part question:

1) click on one of the demo dropdowns on this page. when you tab over to the next input, the text is selected/highlighted in firefox. how can i preve开发者_如何学编程nt this from happening?

2) bonus: can you review my code that is hosted on google and tell me what i can improve?


Well, that is just default behavior on Firefox. A possible workaround is to have the input fields execute a JavaScript or jQuery function on select, have the function blur the field (which would deselect the text) and then refocus on the field. Very basic and I'm sure it'd need a couple extra hacks. Unfortunately without scripting, no there is nothing you can do to prevent that.

I honestly recommend that you leave it alone. That functionality was put in place so you wouldn't have to use your mouse when typing into forms, hitting tab would select all the text so you can easily retype it or hit the right arrow key to go to the end of the field. Removing the functionality will only irritate some of your visitors. If they're using the tab key to get to the next field, they probably want that functionality.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号