如何使得文本框在点击的时候,边框的颜色变成绿色_html/css_WEB-ITnose
来源:懂视网
责编:小采
时间:2020-11-27 15:53:57
如何使得文本框在点击的时候,边框的颜色变成绿色_html/css_WEB-ITnose
如何使得文本框在点击的时候,边框的颜色变成绿色_html/css_WEB-ITnose:回复讨论(解决方案) $(function() { $(:text).focus(function() { $(this).css('border-color', '#0f0'); }).blur(function() { $(this).css('border-color', ''); })}); 还有其他写法么?! 用个css伪类就
导读如何使得文本框在点击的时候,边框的颜色变成绿色_html/css_WEB-ITnose:回复讨论(解决方案) $(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}
如何用div类实现嘞?!
input:focus{ border-style:solid; border-color:#339933}
如何用div类实现嘞?!
用jQuery:
$("#你的input的ID").focus( function(){ $("#你的div的ID").addClass("green"); }).blur( function(){ $("#你的div的ID").removeClass("green"); });
如何使得文本框在点击的时候,边框的颜色变成绿色_html/css_WEB-ITnose
如何使得文本框在点击的时候,边框的颜色变成绿色_html/css_WEB-ITnose:回复讨论(解决方案) $(function() { $(:text).focus(function() { $(this).css('border-color', '#0f0'); }).blur(function() { $(this).css('border-color', ''); })}); 还有其他写法么?! 用个css伪类就