TypeError

Hello,
I m new to Js and i am getting this error. i dont understand why because the id is there

Hi,

Where are you seeing the error.
The Fiddle works as it should for me.

I am using firefox and firebug shows that error also nothing happens when i do the required action

Sorry, it works as expected for me in the latest FF (20.0.1).

The only thing I noticed was that:

<label for="storename">Store Name</label>

should be:

<label for="storeName">Store Name</label>

I have updated the fiddle to my complete one. Pls have a look now

Do you have a new link?
I’m still seeing the old fiddle.

here

Hi,

That works exactly as expected for me in the latest FF and Chrome, too.
I don’t know if that is a good thing or a bad thing :slight_smile:

What is it exactly that you are trying to do?
How can I reproduce your error?

This is my head section


 <!DOCTYPE html>
     <title>Form</title>
    <head>
    <link rel="stylesheet" href="style.css">    
    <script type="text/javascript" src="script.js"></script>
    </head>

i am trying to make a form on which some fields are mandatory without it the form won’t submit and on submit i will send a email most probably via php function
even if chorme i am getting
Uncaught TypeError: Cannot set property ‘onblur’ of null

Ah, ok. What is (very probably) happening that is you are including your JS file at the top of your document and it is trying to reference elements on the page before they exist.

Try moving it to the bottom of your page, like this:

<!DOCTYPE HTML>
  <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Fom</title>
  </head>

  <body>
    ... Your Content ...
    <script type="text/javascript" src="script.js"></script>
  </body>
</html>

Also, in the code you posted, the <title> element should come within the <head> element.

HTH

Thanks! that worked!.

Glad to hear it!
That can be a bit of a gotcha moment when you first encounter it :slight_smile: