Javascript 删除焦点自动选项卡上的只读属性java脚本
我有一些表单,它阻止在填充第一个输入之前填充第二个输入文本,这是我的代码Javascript 删除焦点自动选项卡上的只读属性java脚本,javascript,jquery,Javascript,Jquery,我有一些表单,它阻止在填充第一个输入之前填充第二个输入文本,这是我的代码 功能自动标签(当前,至){ if(current.getAttribute&& current.value.length==current.getAttribute(“maxlength”)){ //to.removeAttr('readonly'); to.focus(); } } 普通Javascript方法称为removeAttribute: to.removeAttribute('readonly');
功能自动标签(当前,至){
if(current.getAttribute&&
current.value.length==current.getAttribute(“maxlength”)){
//to.removeAttr('readonly');
to.focus();
}
}
普通Javascript方法称为removeAttribute
:
to.removeAttribute('readonly');
如果要使用removeAttr
,必须首先将元素转换为jQuery集合:
功能自动标签(当前,至){
if(current.getAttribute&&
current.value.length==current.getAttribute(“maxlength”)){
$(to).removeAttr('readonly');
to.focus();
}
}
普通Javascript方法称为removeAttribute
:
to.removeAttribute('readonly');
如果要使用removeAttr
,必须首先将元素转换为jQuery集合:
功能自动标签(当前,至){
if(current.getAttribute&&
current.value.length==current.getAttribute(“maxlength”)){
$(to).removeAttr('readonly');
to.focus();
}
}
to
是一个DOM对象。将其包装成$()
将解决您的问题:
功能自动标签(当前,至){
if(current.getAttribute&&
current.value.length==current.getAttribute(“maxlength”)){
$(to).removeAttr('readonly');
to.focus();
}
}
to
是一个DOM对象。将其包装成$()
将解决您的问题:
功能自动标签(当前,至){
if(current.getAttribute&&
current.value.length==current.getAttribute(“maxlength”)){
$(to).removeAttr('readonly');
to.focus();
}
}
谢谢你的建议,我也知道removeAttr和removeAttribute的区别谢谢你的建议,我也知道removeAttr和removeAttribute的区别