Get the App
SLTechnology News&Howtos  ›  Development  › 

How jquery cancels radio

Shulou Source: shulou.com Published: 2022-06-01 03:05:23 10月05日 Update

This article mainly shows you "jquery how to cancel radio", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "jquery how to cancel radio" this article.

Jquery cancels radio method: 1, use attr () function, syntax "$(" input "). Attr (" checked ", false);"; 2, use prop () function, syntax "$(" input "). Prop (" checked ", false);".

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

The method of canceling radio by jquery

In jquery, you only need to set the checked property of the radio radio box to the false value to uncheck radio.

There are two ways to set property values:

Attr ()

Prop ()

Example:

Use attr () to set the checked attribute value

$(document) .ready (function () {$("button") .click (function () {$("input"). Attr ("checked", false);}) This month this year, the selection will be canceled.

Use prop () to set the checked attribute value

$(document) .ready (function () {$("button") .click (function () {$("input"). Prop ("checked", false);})

The effect is all the same.

The above is all the contents of the article "how to cancel radio by jquery". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Properties content methods articles functions grammar learning help effects tutorials easy to understand more organization versions environment computers knowledge examples systems ribbons Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Apple Shulou Technology Docker MySQL