Is there a .addType() function for jquery? I know there's a .addClass() to add the class, but I'm appending an input element to a div using the shorthand way and was wondering if there is a .addType() to add the type to the input area i.e text, password, submit.
$(document).ready(function(){
$("#newnum").click(function(){
$("#equation").append(
$("<input/>")
);
});
});
You could just use the shorthand
$('<input type="text">');
There is also the attr()
which would let you do the same thing
$('<input>').attr('type', 'text');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With