Frontend Development

Stupid JS problem (still learning this)

Submitted by AAA, , Thread ID: 21709

Thread Closed

RE: Stupid JS problem (still learning this)

#7
You can use a module called Jquery to do so.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>

function foo() {
var color = document.getElementById("select").value;
document.getElementById("p").innerHTML = "Your favorite color is: " + color;
$(this).css('background-color', color);
}

</script>

Users browsing this thread: 5 Guest(s)