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.
Comments
Post a Comment