I have created a custom shipping method + shipping form like below.
I want to add click event for the check box.
I tried this code in my phtml file.
<script>
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
,ドル
modal
) {
$("#chk_shipusgovt").click(function(){
if($(this).prop("checked") == true){
alert("Checked");
document.getElementById("txt_shipusgovt").style.display = "block";
}
else if($(this).prop("checked") == false){
alert("Not Checked");
document.getElementById("txt_shipusgovt").style.display = "none";
}
});
}
);
This is not working, how can i add this JQuery function to be work.Great help if any one can help me to short it out this issue.
asked Sep 20, 2018 at 5:41
Mujahidh
2,7825 gold badges41 silver badges87 bronze badges
1 Answer 1
Try below code for click event.
$(document).on("click", '#chk_shipusgovt', function(event) {
alert("Clicked!");
});
answered Sep 20, 2018 at 6:16
Kishan Patadia
5,6393 gold badges26 silver badges36 bronze badges
Explore related questions
See similar questions with these tags.
default