给文本加上得到焦点有一个边框,失去焦点后去除边框的效果 

   代码相当简单

 

css:

 


.border-red{border:1px #FF0000 solid}

 

js:

 

 

$("input[type=text]").focus(function(){
$(
this).addClass("border-red")
}).blur(
function(){
$(
this).removeClass("border-red")
})

 

 

html结构:

 

 

<div><input type="text" name="username"><input type="text" name="age"></div>

 


相关文章:

  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
猜你喜欢
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案