Choopernickel
04-30-2004, 05:04 PM
Greetings, salutations.
When creating an input element, one must declare the type, which then becomes immutable.el = document.createElement('input');
el.type = 'text';Fine. No problem. However! When creating a button element, one may not declare the type, as it is created as immutable..el = document.createElement('button');
el.type = "button";
My issue is that I don't want this button to submit the form, which it does because the default button type is "submit." Quote the spec:<!ELEMENT BUTTON - -
(%flow;)* -(A|%formctrl;|FORM|FIELDSET)
-- push button -->
<!ATTLIST BUTTON
...
type (button|submit|reset) submit -- for use as form button --
...>
The oddest part is that after the button is created, alert(el.type) yields undefined in the alert.
Does anyone know more about using the button element with DOM?
When creating an input element, one must declare the type, which then becomes immutable.el = document.createElement('input');
el.type = 'text';Fine. No problem. However! When creating a button element, one may not declare the type, as it is created as immutable..el = document.createElement('button');
el.type = "button";
My issue is that I don't want this button to submit the form, which it does because the default button type is "submit." Quote the spec:<!ELEMENT BUTTON - -
(%flow;)* -(A|%formctrl;|FORM|FIELDSET)
-- push button -->
<!ATTLIST BUTTON
...
type (button|submit|reset) submit -- for use as form button --
...>
The oddest part is that after the button is created, alert(el.type) yields undefined in the alert.
Does anyone know more about using the button element with DOM?