I have on html file in that there is one footer tag like this
<footer data-role="footer" data-theme="b">
<h4 > My Web Site </h4>
</footer>
i want to hide this footer using javascript please help me out.
I have on html file in that there is one footer tag like this
<footer data-role="footer" data-theme="b">
<h4 > My Web Site </h4>
</footer>
i want to hide this footer using javascript please help me out.
- Please say what you've tried next time, perhaps including what you've searched for. – jmdeldin Commented Sep 24, 2012 at 5:49
- okay thank you for you suggestion next time i won't do this. – Nishit Patel Commented Sep 24, 2012 at 5:56
2 Answers
Reset to default 13You can use document.querySelector
or document.getElementsByTagName
.
document.querySelector('footer').style = 'display: none'
You could assign this footer an id and then use the document.getElementById to retrieve it and hide it:
document.getElementById('footer_id').style = 'display: none;';
As an alternative you could use the document.getElementsByTagName
function if you cannot modify the markup.
var footers = document.getElementsByTagName('footer');
footers[0].style = 'display: none;';
Obviously if you have more than one <footer>
elements in your markup the getElementsByTagName
function will return all of them and you will have to pick the right element from the array.