i'm trying to write a credit card validation script using the luhn algorithm, but i can't even manipulate the string input right to even get myself started. just trying to take out hyphens and spaces from the string but it keeps saying in the debugger that my function has no replace method? im not a programmer, just trying to get through this class.....
here's my code, there might be a line or 2 in there for testing purposes that i forgot to remove.
<script type="text/javascript">
function fixString(){
//get credit card number
var ccNumber = document.getElementById("ccNumber");
//remove hyphens and spaces
var ccNumber = ccNumber.replace(/-/g, "");
//.replace(/\n/g, "");
show.innerHTML = ccNumber.value;
}
</script>
<body>
<form action="#">
<p><label>Enter credit card number here:<input id="ccNumber" type="text">
</label> <input value="Validate" onclick="fixString()" type="button"> </p>
</form>
<p id="show"></p>
</body>