function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Uday KUday K 

Java Script Alert Issue in Internet Explorer

Hello All,

 

Below java Script code is working fine in all browsers. But this is not working in IE.
Please anyone give an immediate response.

This is Java Script code on VF Page

function checkAcknowledgement(){
 if (acknowledgement.checked == false){
alert('Please read Agreement and Terms.');
return false;
}else {
return true;
}
}

 

This is input tag in the VF page where i used the above Java Script.

<input type="checkbox" id="acknowledgement" name="ack" />&nbsp;&nbsp; &nbsp; &nbsp;I agree to these terms &nbsp;&nbsp;  &nbsp;&nbsp; &nbsp;<apex:commandLink value="View" style="color:red;" onclick="check1();return false;" /> &nbsp;&nbsp; &nbsp; &nbsp;   </td> (This is check box.)

 

<apex:outputText rendered="{!boolimg}"><apex:commandLink action="{!insertPayInfo}"  id="theCommandLink2"     onclick="return checkAcknowledgement(this)" >  <apex:image value="{!$Resource.PayNow}" /></apex:commandLink></apex:outputText> (This is Command Button. When i click this button it should give java script alert pop up, if the checkbox is not checked)

 

Thanks,

Uday

Adam HowarthAdam Howarth

Hey,

 

You need to change your javascript function to this:

 

function checkAcknowledgement(){
if (document.getElementById('acknowledgement').checked == false){
alert('Please read Agreement and Terms.');
return false;
}else {
return true;
} 
}

 

Ive tested and it works :)

 

Cheers