Saturday, May 12, 2018

Choose color and Change text Color

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
       var f= $("#b").val();
$("#p").css("color",f);
    });
});

</script>
</head>
<body>
<form>
<input type="color" id="b" />

<p id="p">Hello</p>

<button>Click me</button>
</form>
</body>
</html>

No comments:

Post a Comment