JavaScript 聚焦并选择表格输入

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript 聚焦并选择表格输入相关的知识,希望对你有一定的参考价值。

/** @id codeFocus 
* @classDescription Focuses on the selected input and selects the value text. 
*/
var postcodeFocus = {
	grab:function(){
		if(!document.getElementById){return;};
		if(!document.getElementById('selected')){return;};
		var theInput = document.getElementById('selected');
		theInput.focus();
		theInput.select();
	}
}

以上是关于JavaScript 聚焦并选择表格输入的主要内容,如果未能解决你的问题,请参考以下文章

聚焦并选择输入移动

聚焦并选择表单输入

Kendo Grid 如何以编程方式聚焦网格单元并阻止选择文本

javascript JQuery - 输入聚焦/模糊类切换

vue input 输入框聚焦

在 purescript-halogen 中创建后自动聚焦输入元素