I made a div with jquery, and after that div is made i want to change the css of it. However, the change doesn't work.
This is my HTML:
<form>
<input type="text" id="color" placeholder="color"><br>
<input type="text" id="height" placeholder="height"><br>
<input type="text" id="width" placeholder="width"><br>
<input type="button" id="make" value="Make">
</form>
and this is the jquery:
$(document).ready(function() {
$('#make').click(function() {
if (($('#color').val().length) == 0 || ($('#height').val().length) == 0 || ($('#width').val().length) == 0 ) {
alert('lol')
} else {
var color = $('#color').val();
var height = $('#width').val();
var width = $('#height').val();
$('body').append('<div id="kast" style="background:'+color+'; width:'+width+'px; height:'+height+'px;"></div>')
$('#make').remove();
$('form').append('<input type="button" id="change" value="Change">');
}
})
$('#change').click(function() {
var color = $('#color').val();
var height = $('#width').val();
var width = $('#height').val();
$('#kast').css('background-color', color);
})
})
I hope someone can help me :)