I want to Change the title of a HTML button once clicked. this is what I tried.
HTML
<button class="fullScreen" data-dojo-type="dijit.form.Button" onclick="FullScreenToggle(this);" id="butFullScreen">
<input type="image" class="ns" onclick="FullScreenToggle(this);" title="Full Screen" value="" />
JS
if (document.getElementById("butFullScreen").title == "Full Screen") {
document.getElementById("butFullScreen").title = "";
document.getElementById("butFullScreen").title = "Normal Screen";
} else document.getElementById("butFullScreen").title = "Full Screen";
When I do this Title doesn't change in JavaScript call. then I tried using title="" in HTML, then title changes on Java Script call. but when button is loaded first time I dont have a title. I want have Full Screen as title when button is loaded and then toggle it between Normal Screen & Full Screen on each click.
Once I set title="Full Screen" in my HTML, a JavaScript call doesn't change it.
u need to call a function onload site Execute a JavaScript when a page is finished loading:
In HTML:
<body onload="FullScreenToggle();">
In JavaScript:
window.onload=function(){FullScreenToggle();};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With