jquery显示隐藏input对象,jqueryinput对象
jquery显示隐藏input对象,jqueryinput对象
1 所属部门选择其他时 显示一个输入框进行填写
#html <select id='deptid' name='deptid' class="select" onchange='deptChange()'> <c:forEach var="item" items="${deptidList}" varStatus="status"> <option value='${item.value}'> ${item.name} </option> </c:forEach> </select> <!-- 类型为其他时 需要填写其它部门 --> <input id='otherDept' name='otherDept' type="text" class="text" maxlength='50' style='display:none;'/>
//js // 根据切换是否显示其他部门输入框 function deptChange(){ var deptid = $('#deptid').val(); // alert('type:'+hytpye); if(deptid=='other'){ $('#otherDept').show(); }else{ $('#otherDept').hide(); } }
// 设置type$('input').attr('type', 'text');$('input').attr('type', 'password');
楼上的就可以了 判断当前的显示状态
当然也可以直接使用jquery的is判断是否隐藏
if($('#id').is(':visible'))
相关内容
- JQuery中$(document)是什么意思有什么作用,jquerydocument
- 一个简单的jQuery计算器实现了连续计算功能,jquery计算
- 关于jQuery判断元素是否存在的问题示例探讨,jquery示例
- jquery中的常用事件bind、hover、toggle等示例介绍,jquery
- js正则判断非法字符限制输入,js字符
- 一个小例子解释如何来阻止Jquery事件冒泡,阻止jquery事
- jQuery中attr()和prop()在修改checked属性时的区别,jqueryat
- jQuery新的事件绑定机制on()示例应用,jqueryon
- JQuery对表单元素的基本操作使用总结,jquery基本操作
- 关于javaScript注册click事件传递参数的不成功问题,jav
评论关闭