javascript - Why are the buttons of the type submit? -


this html:

<button>static</button> <form> <span id="test"> </span> </form> 

this jquery - runs in document.ready:

    $('#test').append('<button>dynamic</button>');      $('button').live('click', function(){        alert($(this).attr('type'));      });      //even one:     alert($('<button>test</button>').attr('type')); 

the alerts says 'type' 'submit', haven't specified type. how come? @ least ie , chrome consequent in giving type "submit". don't have form, seems weird make submit-button.

the default value type attribute <button> elements defined 'submit' in specification.

submit: creates submit button. default value.

http://www.w3.org/tr/html4/interact/forms.html#h-17.5


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -