function getUrlVars(){ var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value){ vars[key] = value; }); return vars; } var getBt = getUrlVars()["bt"];
According to the getBt variable here, how can I do 'checked' from the options below to the value equal to value?
So, for example, if the value of getBt is 2, I want to select the radio option with value 2.
<div class="card-body"> <label class="custom-control custom-radio"> <input type="radio" name="Filter[type][]" checked="" value="0" class="custom-control-input"> <div class="custom-control-label">All</div> </label> <label class="custom-control custom-radio"> <input type="radio" name="Filter[type][]" value="1" class="custom-control-input"> <div class="custom-control-label">option1</div> </label> <label class="custom-control custom-radio"> <input type="radio" name="Filter[type][]" value="2" class="custom-control-input"> <div class="custom-control-label">option2</div> </label> <label class="custom-control custom-radio"> <input type="radio" name="Filter[type][]" value="3" class="custom-control-input"> <div class="custom-control-label">option3</div> </label> </div>
没有评论:
发表评论