// Hide div :
document.getElementById(div_id).style.display = none;
/// Show div :
document.getElementById(div_id).style.display = block;
const element = document.getElementById('id');
//or
const element = document.querySelector('#id');
function myFunc(variable){
var s= document.getElementById(variable);
s.value = 'New value'
}
// Save a reference to the element with id 'demo':
const demoElement = document.getElementById('demo');
function changeColor(newColor) {
var elem = document.getElementById('para');
elem.style.color = newColor;
}
function changeColor(newColor) {
var elem = document.getElementById('para');
elem.style.background-color = newColor;
}
document.getElementById("test")
let variableName = document.getElementById('#Id_name_you_gave_the_element');
<h1 id="demo">
<style>function demoFunction()
{document.getElementById("demo"). //Add what you want to change right here.}
</style>
var degiskenAdi = document.getElementById("paragraf1");
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
//JavaScript can create dynamic HTML content:
<script>
document.getElementById("demo").innerHTML = "Date : " + Date(); </script>
</body>
</html>
// getElementById returns elements that have the id specified. Example:
document.getElementById("specificparagraph").style.color = "blue";
/* The element with the id "specificparagraph" will have its text changed to
blue. */
<p id="YourId">How to use document.GetElementById in HTML</p>
<script>
document.GetElementById('YourId')./* The thing you need to do to your code... Here I want .innerHTML you can take any... */.innerHTML('/* what will it change... */')
</script>
<?php
$doc = new DomDocument;
// We need to validate our document before referring to the id
$doc->validateOnParse = true;
$doc->Load('my.xml');
echo $doc->getElementById('php-basics') . "
";
?>