---------------------------------------------------
<h1 id="title1">ys</h1>
<input type="text" id="txt"/>
<input type="button" onclick="show()" value="click" />
<script>
function show() {
var myvar = document.getElementById('txt').value;
console.log(myvar)
if(myvar.length == 0){
alert('plz enter the value');
return;
}
var mytitle = document.getElementById('title1');
mytitle.innerHTML = myvar;
}
</script>
---------------------------------------------------
<h1 id="title1">ys</h1>
<input type="text" id="txt"/>
<input type="button" onclick="show()" value="click" />
<script>
function show() {
var myvar = document.getElementById('txt').value;
console.log(myvar)
if(myvar.length == 0){
alert('plz enter the value');
return;
}
var mytitle = document.getElementById('title1');
mytitle.innerHTML = myvar;
}
</script>
---------------------------------------------------
No comments:
Post a Comment