Jquery shows hidden input objects and jqueryinput objects.

Source: Internet
Author: User

Jquery shows hidden input objects and jqueryinput objects.

1. Enter an input box when selecting another department



#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>
<!-If the type is other, other departments need to be filled in->
<input id = 'otherDept' name = 'otherDept' type = "text" class = "text" maxlength = '50 'style =' display: none; '/>
// js
// Whether to display other department input boxes according to the switch
  function deptChange () {
  var deptid = $ ('# deptid'). val ();
  // alert ('type:' + hytpye);
  if (deptid == 'other') {
   $ ('# otherDept'). show ();
  } else {
   $ ('# otherDept'). hide ();
  }
  } 

How can I change the input type without explicit hiding using jquery?

// Set type $ ('input'). attr ('type', 'text'); $ ('input'). attr ('type', 'Password ');

Indicates whether the jquery interpreter object is hidden.

Upstairs, you can determine the current display status
Of course, you can also use jquery's is to determine whether to hide it.
If ($ ('# id'). is (': visible '))

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.