Jquery method to change the type attribute of input: 1. Create an html file and introduce the jQuery file; 2. Create an input box with the input tag in the P tag, and set the default value of value to abcdefg, input tag The ID is tuiput; 3. Create a button with the button tag and bind the onclick event; 4. Use the "$('#tuinput').attr('type','password');" syntax.
The operating system of this tutorial: Windows 10 system, jQuery3.6.0 version, Dell G3 computer.
jquery changes the type attribute of input through the "attr()" method:
1. Create a new html file, name it test.html, and introduce it in the head jQuery file
2. In the html file, within the p tag, use the input tag to create an input box, and set its default value to abcdefg
3. In the test.html file, set the id attribute value of the input tag to tuinput, which is mainly used to obtain the input object through this id below
4. In the test.html file, use the button tag to create a button with the button name "Change the type attribute of input"
5. In test. In the html file, bind the onclick click event to the button button. When the button is clicked, the editype() function is executed
#6. In the js tag, create editype() Function, within the function, obtain the input object through id (tuinput), use the attr() method to change the type attribute value to password
7. Open the html file in the browser, Click the button to see the effect
The above is the detailed content of How to change the type attribute of input in jquery. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),