我想做一个淘宝默认地址选中,选中一个div,就赋为选中状态,没有选中的则为默认状态
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <script type="text/javaScript" src="jquery.js"></script> <style type="text/css"> .addressBox{width:200px; height:100px; background:#ccc; margin-top:20px;cursor: pointer;} .addressBox img{padding-top:30px;} .setDefault{display: block;} .default{display: none;} </style> <script> $(function(){ $(".addressBox").click(function(){ $(".addressBox>.setDefault").hide(); $(".addressBox>.default").show(); }) }) </script> </head> <body> <div class="addressBox" id="box1"> <img class="setDefault" src="img/setDefault.png"> <img class="default" src="img/default.png"> </div> <div class="addressBox" id="box2"> <img class="setDefault" src="img/setDefault.png"> <img class="default" src="img/default.png"> </div> <div class="addressBox" id="box3"> <img class="setDefault" src="img/setDefault.png"> <img class="default" src="img/default.png"> </div> </body> </html>
玩意11
susan100
印仔