JavaScript Onclick Change CSS #Part 10

 JavaScript Onclick Change CSS #Part 10



         JavaScript program to change HTML CSS on click button.

HTML and JavaScript Code


    

    

   <!--css-->

<style>

button

{

background-color: lightgreen;

border-radius:8px;

}

</style>

<!--html-->

<p id="p1">code Pocket is a websites that you have a knowledge about website designing related tutorials.</p>

<button onclick="myfun()">click Me 

</button>

<!--javascript-->

<script>

function myfun()

{

let p = document.querySelector('#p1');

p.style.color='red';

p.style.fontFamily='cursive';

p.style.fontweight='90px';

}

</script>

    

Try it Yourself...

what you think about this article ??

Post a Comment

Previous Post Next Post