johnny
johnny

Reputation: 13

Javascript function not working issue

Ok so I have a function that should make a button enabled if the requirements are met and they are.

Here is the method:

function CheckToEnableSubmit()

{

var Credit = ValidateCreditCard();
var Name = ValidateName();
var PPSN = ValidatePPSN();
var Phone = ValidatePhone();



var Size = SizeSelected();
var Flavour = FlavourSelected();
var Icing = IcingSelected();

if (Credit && Name && PPSN && Phone) 
{
    document.getElementById("submit").disabled = false;
} else {
    document.getElementById("submit").disabled = true;
}


}

and the JFiddle:

http://jsfiddle.net/UTtxA/51/

I will give correct answer to the best explantion of why it is not working.

if you want to test use:

-The name field "ggggg ggggg"

-phone "0854444444"

-credit "4716756572491904"

-ppsn "5555555j"

Upvotes: -1

Views: 288

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388436

Your fiddle is throwing an error in the console, that is why it is not working

Uncaught TypeError: Cannot set property 'disabled' of null

You don't have id for the submit button

<input type="submit" id="submit" value="Place Order" onclick="" disabled>

Demo: Fiddle

Upvotes: 2

Related Questions