I would like to obtain the next line of code using JQuery:
<div class="something something_else">
</div>
I use $(document.createElement('div'));
to create the div, but then how do I add something
and something_else
to the div?
I'm sure it's something basic, but I can't seem to figure it out.
Try this:
$('<div/>', {"class": "something something_else" })
var div = document.createElement('div');
div.className = "something something else";
$('<div/>').addClass("something something else");
$('<div class="something something else"/>');
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