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
NakataNakata 

How to eliminate special character ?

Good day,

 

I need to invoke ajax call when user tick on checkbox, below is the code

 

 

<apex:inputCheckbox value="{!myvalue}" rendered="{!hasField}" onclick="{! 'javascript:if(document.getElementById('myField') == null){alert('Message call');} else { handleClicked();} '}}" />

When i put in this and save, it prompt me error on missing '}'  ....i try putting '\' in front of all single quote and it able to save , but it doesn't function when i tick on it 

 

 

'javascript:if(document.getElementById(\'myField\') == null){alert(\'Message call\');} else { handleClicked();} '

 

any clue how i can fix it ? Thanks in advance

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Richie DRichie D

Hi,

 

Think this'll work:-

 

 

<apex:inputCheckbox value="{!myvalue}" rendered="{!hasField}"onclick="javascript&colon;if(document.getElementById('myField') == null){alert('Message call');} else { handleClicked();}"/>

R.