
Bu yazımızda JavaScript ile HTML elemanlarının nasıl değiştirilebileceğini inceleyeceğiz
document.getElementById(“id”) metoduyla HTML bileşenine erişebiliriz . Bu metodun innerHTML metoduylada bileşenin html değeri değiştirilir
Örnek HTML
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
{
document.getElementById("demo").innerHTML="Paragraf Değişti";
}
</script>
</head>
<body>
<h1 id="demo">Paragraf 1</h1>
<button type="button" onclick="myFunction()">Paragrafı Değiştir</button>
</body>
</html>
