I have a form with 2 fields. When all fields' values are filled, I need to display/show the Register button in hide stage. I am using jquery but it is not working. Where did I make a mistake?
<apex:page standardController="pop__c">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
var $ = jQuery.noConflict();
(function() {
// alert('hi);
$('form > input').keyup(function() {
var empty = false;
$('form > input').each(function() {
if ($(this).val() == '') {
empty = true;
}
});
if (empty) {
$('input[id*=register]').attr('disabled', 'true');
} else {
$('input[id*=register]').removeAttr('disabled');
}
});
})()
</script>
<apex:form >
FirstName:<apex:inputField value="{!pop__c.Name}" id="nid"/><br/>
LastName:<apex:inputField value="{!pop__c.LastName__c}" id="fid"/>
<apex:commandButton value="REGISTER" action="{!SAVE}" disabled="true" id="register"/>
</apex:form>
</apex:page>