<!DOCTYPE html>
<html>
<script>
function Test(){
var x=document.getElementById("Test");
if((x.innerHTML).includes("*")){
x.innerHTML=x.innerHTML.slice(0, -1);
}
else{
x.innerHTML=x.innerHTML+"*";
}
}
</script>
<body>
<label id="Test" for="new">My First JavaScript*</label>
<button type="button"
onclick="Test()" id="new" name="new">New
</button>
<p id="demo"></p>
</body>
</html>
<html>
<script>
function Test(){
var x=document.getElementById("Test");
if((x.innerHTML).includes("*")){
x.innerHTML=x.innerHTML.slice(0, -1);
}
else{
x.innerHTML=x.innerHTML+"*";
}
}
</script>
<body>
<label id="Test" for="new">My First JavaScript*</label>
<button type="button"
onclick="Test()" id="new" name="new">New
</button>
<p id="demo"></p>
</body>
</html>
Comments
Post a Comment