码迷,mamicode.com
首页 > Web开发 > 详细

28-30 js 文本全选

时间:2018-07-01 13:02:37      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:input   style   color   back   span   tip   ntb   play   none   

要点:使用select();

上代码:

if (e.keyCode === 27){
             document.getElementById(‘input‘).select()
}
//当点击键盘esc键时候,对input框进行全选。

修改样式:

document.getElementById(‘list‘).style = ‘display: none;‘

liDom[nowSelectTipIndex].style.backgroundColor=‘green‘

innerHTML:

 //将生成内容添加到dom中
    addContent = function (valueList) {
        var ul = ‘‘;
         for (item of valueList) {
            ul += `<li>${item}</li>`
         }
        document.getElementById(‘list‘).innerHTML = ul;
    };

//注意可以有html标签

 

28-30 js 文本全选

标签:input   style   color   back   span   tip   ntb   play   none   

原文地址:https://www.cnblogs.com/yadiblogs/p/9249804.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!