Hi Michiel,

It sounds like you're able to access the attribute using something
like:

var myVal = document.getElementById('#inputBox').defaultValue; //
similar to the w3cschools example

This is a DOM attribute rather than an XHTML attribute - which is why
the attr method won't return the value.  For instance:

<input id="inputBox" type="text" defaultValue="234" />

Is not valid XHTML.

You can't access the defaultValue via the attr method because it's
reading from 'getAttribute'.

However, if you do need the attribute in your code, it's a simple case
of the following:

$('#inputBox')[0].defaultValue;

Since we're taking the first (and only match) element jQuery returned,
we can access the DOM attribute directly.

Hope that helps.

Reply via email to