回复讨论(解决方案)
$(function() { $(":text").focus(function() { $(this).css('border-color', '#0f0'); }).blur(function() { $(this).css('border-color', ''); })});
还有其他写法么?!
用个css伪类就好了
input:focus {
border-style: solid;
border-color: #339933;
}
input:focus{ border-style:solid; border-color:#339933}
input:focus{ border-style:solid; border-color:#339933}
如何用div类实现嘞?!
input:focus{ border-style:solid; border-color:#339933}
如何用div类实现嘞?!
用jQuery:
.green{ border-style:solid; border-color:#339933 } $("#你的input的ID").focus( function(){ $("#你的div的ID").addClass("green"); }).blur( function(){ $("#你的div的ID").removeClass("green"); });
查看更多关于如何使得文本框在点击的时候,边框的颜色变成绿色_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did105242