OrangePineapple OrangePineapple - 1 month ago 6
Javascript Question

creating your own div

I'm new to

JavaScript
and
jQuery
and I have this code:

$("input[type = submit]").click(function(){
$("<div/>").html(itemInput.value).appendTo(".div1");
clearInput();
})


I am wondering if there is a way to "personalize" the "div" in line 2. Like give it a color background or change the font ?

SIE SIE
Answer
$("<div><div/>").attr("style", "background-color: lightblue; font-size: 16px;");
Comments