3种方法:1、用removeAttr()去除radio框的checked属性,语法“单选框对象.removeAttr("checked");”。2、用attr()将checked属性的值设置为false,语法“对象.attr("checked",false)”;3、用prop()将checked属性的值设置为false,语法“对象.prop("checked",false)”。
本教程操作环境:windows7系统、jquery3.6.0版本、Dell G3电脑。
jquery去掉radio单选框选中状态的3种方法
方法1:使用removeAttr()
radio单选框的选中状态是由checked属性控制的,只需使用removeAttr()去掉该属性即可。
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <script src="js/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("input").removeAttr("checked"); }); }); </script> <style> p{ width: 200px; height: 100px; border: 1px solid #AFEEEE; background-color: #AFEEEE; } </style> </head> <body> <input type="radio" name="radio1" value="value1" />选项1<br> <input type="radio" name="radio1" value="value2" checked />选项2<br> <input type="radio" name="radio1" value="value3" />选项3<br><br> <button>去掉radio选中状态</button> </body> </html>
方法2:使用attr()
也可使用attr()将radio单选框的checked属性设置为false值来取消radio选中。
$(document).ready(function(){ $("button").click(function(){ $("input").attr("checked",false); }); });
方法3:使用prop()
也可使用prop()将radio单选框的checked属性设置为false值。
$(document).ready(function(){ $("button").click(function(){ $("input").prop("checked",false); }); });
【推荐学习:jQuery视频教程、web前端视频】
以上是jquery怎么去掉radio单选框的选中状态的详细内容。更多信息请关注PHP中文网其他相关文章!

Include:1)AsteeplearningCurvedUetoItsVasteCosystem,2)SeochallengesWithClient-SiderEndering,3)潜在的PersperformanceissuesInsuesInlArgeApplications,4)ComplexStateStateManagementAsappsgrow和5)TheneedtokeEedtokeEedtokeEppwithitsrapideDrapidevoltolution.thereedtokeEppectortorservolution.thereedthersrapidevolution.ththesefactorsshesssheou

reactischallengingforbeginnersduetoitssteplearningcurveandparadigmshifttocoment oparchitecent.1)startwithofficialdocumentationforasolidFoundation.2)了解jsxandhowtoembedjavascriptwithinit.3)

ThecorechallengeingeneratingstableanduniquekeysfordynamiclistsinReactisensuringconsistentidentifiersacrossre-rendersforefficientDOMupdates.1)Usenaturalkeyswhenpossible,astheyarereliableifuniqueandstable.2)Generatesynthetickeysbasedonmultipleattribute

javascriptfatigueinrectismanagbaiblewithstrategiesLike just just in-timelearninganning and CuratedInformationsources.1)学习whatyouneedwhenyouneedit

totlecteactComponents通过theusestatehook,使用jestandReaCtteTingLibraryToSigulation Interactions andverifyStatAtaTeChangesInTheUI.1)renderthecomponentAndComponentAndComponentAndCheckInitialState.2)模拟useclicklicksorformsormissionsions.3)

KeysinreactarecrucialforopTimizingPerformanceByingIneFefitedListupDates.1)useKeyStoIndentifyAndTrackListelements.2)避免使用ArrayIndicesasKeystopreventperformansissues.3)ChooSestableIdentifierslikeIdentifierSlikeItem.idtomaintainAinainCommaintOnconMaintOmentStateAteanDimpperperFermerfermperfermerformperfermerformfermerformfermerformfermerment.ChosestopReventPerformissues.3)

ReactKeySareUniqueIdentifiers usedwhenrenderingListstoimprovereConciliation效率。1)heelPreactrackChangesInListItems,2)使用StableanDuniqueIdentifiersLikeItifiersLikeItemidSisRecumended,3)避免使用ArrayIndicesaskeyindicesaskeystopreventopReventOpReventSissUseSuseSuseWithReRefers和4)

独特的keysarecrucialinreactforoptimizingRendering和MaintainingComponentStateTegrity.1)useanaturalAlaluniqueIdentifierFromyourDataiFabable.2)ifnonaturalalientedifierexistsistsists,generateauniqueKeyniqueKeyKeyLiquekeyperaliqeyAliqueLiqueAlighatiSaliqueLiberaryLlikikeuuId.3)deversearrayIndiceSaskeyseSecialIndiceSeasseAsialIndiceAseAsialIndiceAsiall


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

Atom编辑器mac版下载
最流行的的开源编辑器

WebStorm Mac版
好用的JavaScript开发工具

Dreamweaver Mac版
视觉化网页开发工具

SublimeText3 Linux新版
SublimeText3 Linux最新版