当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jquery显示隐藏input对象

jquery显示隐藏input对象

2019年04月06日  | 移动技术网IT编程  | 我要评论

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();
 }
 }


如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网