Here is the error
You are saying
var second = document.getElemntById('cpassword').value;
it should be
var second = document.getElementById('cpassword').value;
0
solved Error with document.getElementById: Uncaught TypeError: undefined is not a function [closed]