在input 输入框中嵌入链接的效果

html:
<div class="inputDiv">
  <input type="text"  class="input" id="name">
  <a href="javascript:void(0)" class="add" onclick="add()">
    +
  </a>
</input>
</div>

css:
.input{
  border:0px;
  width:90%;
  outline:none;
}
.inputDiv{
  border:1px solid #ccc;
  width:200px;
}
.add{
  text-decoration:none;
  width:10%;
}
js:
function add(){
  alert("add");
}

效果可参见: http://www.jscssshare.com/#/sample/OGPcMQvT

猜你喜欢

转载自coosummer.iteye.com/blog/2299879