怎么使得文本框在点击的时候,边框的颜色变成绿色

尊敬的用户,经系统检测,该篇日志中可能存在违规嫌疑内容,已被系统暂时屏蔽,请您检查。确认清理完毕后,请输入验证码申请解除屏蔽。
验证码:换一张
提 交
怎么使得文本框在点击的时候,边框的颜色变成绿色


如何使得文本框在点击的时候,边框的颜色变成绿色


------解决方案--------------------

<script src=/scripts/jquery-1.8.3.min.js></script>

<script>

$(function() {

  $(":text").focus(function() {

    $(this).css('border-color', '#0f0');

  }).blur(function() {

    $(this).css('border-color', '');

  })

});

</script>

<input type=text>

<input type=text>

<input type=text>

<input type=text>


------解决方案--------------------
用个css伪类就好了
input:focus {
border-style: solid;
border-color: #339933;
}
------解决方案--------------------



input:focus{

    border-style:solid;

    border-color:#339933

}


------解决方案--------------------
引用:

Quote: 引用:



input:focus{

    border-style:solid;

    border-color:#339933

}



如何用div类实现嘞?!

用jQuery:



<style type="text/css">

    .green{

        border-style:solid;

        border-color:#339933

    }

</style>

$("#你的input的ID").focus(

    function(){

        $("#你的div的ID").addClass("green");      

    }

).blur(

    function(){

        $("#你的div的ID").removeClass("green");       

});
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值