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
Naresh Kumar 7Naresh Kumar 7 

How to compare inputField value with string on VF page?

Can any one plz tell me

how we can compare input field value with String on VF page.
sharathchandra thukkanisharathchandra thukkani
You can do that in javascript....If you have controller associated with it then you can do in class also.

Something like this might work for you.This code is not tested. 

function compareString(){
    var strElement = document.getElementById('{!$}').value;
    if(strelemt == 'check')
          return true
return false;

<apex:form id='validateString'>
    <apex:commandButton id="save"  onclick="javascript:compareString()"/>
    <apex:inputfield id='validateString' >