设置两个input输入框,把它们拼接到一起去掉中间的边框,左边的边框定死了内容并且设置成无法更改,右输入框输入,设置成右输入框获取或者失去焦点时左输入框的边框颜色发生改变就行
$("#advLinkShow").val("http://");
$("#advLink").focus(function(){
$("#advLinkShow").css({ "border-color": "#1E66BD" });//$("#advLink").css({ "outline": "none" });
});
$("#advLink").blur(function(){
$("#advLinkShow").css({ "border-color":"#C7CFD9"});
});
$("#advLinkShow").focus(function(){
$("#advLink").focus();
});
<th>链 接</th>
<td colspan="4"><p><input type="text" class="text" id="advLinkShow" style="outline:none;width:50px;border-right:0;margin-right:0px;" readonly="readonly"/>
<input type="text" class="text" name="advLink" id="advLink" cmps="@{advLink}" maxlength="300" data-validation-engine="validate[required]" style="outline:none;width:142px;border-left:0;margin-left:-10px;padding-left:0px;"/></p>
</td>