点击事件触发input焦点(手机端也可以使用)

html

<div class="giveLikeOne">
<img src="./img/takePictures02.png" alt="">
<span>6</span>
</div>

js

('.giveLikeOne').on('click', function (e) {('.bottom').show();
// alert(('.bottom')); console.log(('.bottom').children('input[type=text]'));
e.preventDefault();//阻止A标签跟随url
// ('.bottom').children('input[type=text]').trigger('click');('.bottom').children('input[type=text]').focus();
})

css

.bottom {
position: fixed;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 50px;
background-color: #FFFFFF;
text-align: center;
}
.bottom input {
text-indent: 0.1rem;
margin-top: 0.08rem;
width: 86%;
height: 65%;
background: #EEEEEE;
}
.bottom button {
color: red;
}

效果图

点击前

image.png

点击后

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容