我想改变文本框的颜色时,在html焦点。但我的颜色没有变!
Html
<!DOCTYPE html>
<html>
<head>
<title>Make a new account</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="script.js" type="text/jav
更新:在DOM呈现完成之前,无法直接将焦点应用于文本框。
我想知道为什么focus()函数不能在隐藏元素上工作。
例如(我正在使用Vue.js ):
var vm = new Vue({
el: "#app",
data:{
showtext: false
},
methods: {
showTxt(ev){
this.showtext = true
var vm = this;
// if I uncomment setTimeout, then the textbox can set focus