/*
selectInput v1.1
code:by Deeka
QQ:80140281
e-mail:huangdijia@163.com
技术群:24810664
修正:1.FF与IE下的样式小问题
2.INPUT长度问题
支持多个input(特别鸣谢==,cssrain,及帮忙测试的群友们)
*/
$.fn.inputer = function(o) {
var obj = this;
jQuery.each(obj,function(i,obj_sub){
var inputerId = "_inputer" + obj_sub.id;
var iset = $("input[id=" + obj_sub.id + "]").offset();
$("input[id=" + obj_sub.id + "]").after("<select id=\"" + inputerId + "\" name=\""+ inputerId +"\"></select>");
//IE和FF有一点点区别
$("select[id=" + inputerId + "]").width($(obj_sub).width() + ($.support.msie?6:4) + "px");
$("select[id=" + inputerId + "]").css({position:"absolute",
display:"none",
left:function(){return iset.left;},
top:function(){return $.support.msie?iset.top:iset.top + 1 +"px"},
clip:"rect(1px " + ($("select[id=" + inputerId + "]").width() + ($.support.msie?6:8) + "px") + " " + ($("select[id=" + inputerId + "]").height() + ($.support.msie?1:2) + "px") + " " + ($("select[id=" + inputerId + "]").width() - 15 + "px") + ")",
"font-size":obj.css("font-size")
});
var option = "<option>请选择</option>";
$.each(o,function(ovar,opt){
option += '<option value=' + ovar + '>' + opt.trim() + '</option>';
});
$("select[id=" + inputerId + "]").append(option)
.css({display:"block"})
.change(function(){
$("input[id=" + obj_sub.id +"]").val($("option:selected",this).html());
});
});
};
忘记了是从哪里找到的了,原创如果看到可以告诉我医生,我加上链接
一个可输入的下拉框插件
最新推荐文章于 2022-04-27 11:53:25 发布