1. p-elementti.
2. p-elementti.
JQuery, head-elementtiin:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p:first").replaceWith("<span id='puna'>Teksti vaihdettu!</span>");
});
});
</script>
HTML-koodaukset:
<p>1. p-elementti.</p>
<p>2. p-elementti.</p>
<button> Korvaa 1. p-elementin teksti </button>