Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Cannot access Form object using JavaScript

I have some pretty basic code here to submit a form (I plan to have it change some items first, but until I can get the submit working - what's the point?)

The code is:

function reschedGame(){
            var x = document.getElementByID("update");
            x.submit();
            
      }

Where update is, in fact, the id of the form. The name of the form is also update.

If I try something like:

function reschedGame(){
            alert("Hey this works!");
      }

The function fires on click.

Any thoughts?
0
dirknibleck
Asked:
dirknibleck
2 Solutions
 
hieloCommented:
Change:
var x = document.getElementByID("update");
to:
var x = document.getElementById("update");

Javascript is case sensitive.
0
 
Göran AnderssonCommented:
Javascript is case sensetive.

Change getElementByID to getElementById.
0
 
dirknibleckAuthor Commented:
I officially feel blind as a bat.

Solutions delivered at exactly the same time (or near enough) so I split it. Thanks!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now