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.