I am using the following code to automatically have one checkbox in a list of many prefilled when a button is clicked in a product page for more information. This code is taken from a previously solved question, but it does not work for me. What am I doing wrong?
PAGE A (button)
<a href="pageB.php#myHash" id="select-checkbox1">More Information</a>
PAGE B
$(document).ready(function(){
var hash = location.hash; //
f(hash=="#myHash"){
("#checkbox1").prop("checked", !$("#checkbox1").prop("checked") );
}
});
<input type="checkbox" id="checkbox1" name="boxset" value="XXXX">
Also PAGE A is a Wordpress page which automatically reverses the href for some reason.
<a id="select-checkbox1" href="pageB.html#myHash">More Information</a>
I have tried this in two other websites with the same problem. It obviously does not like the format. I would appreciate some help with this.
Aucun commentaire:
Enregistrer un commentaire