Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide H1 Element using JavaScript

Tags:

javascript

I want to hide the <h1> element using plain javascript, not jQuery, without adding id="whatever" or class="whatever" to the tag. Is this possible?


Why can't I just add id="whatever" to the tag?
I'm using a UIButton in xCode that when clicked, it injects javascript into a UIWebView. Inside that UIWebView is a H1 element that is on a website that I do not have access to to add <h1 id="whatever">. I hope it makes sense.

like image 607
Harry Avatar asked Feb 12 '13 09:02

Harry


1 Answers

document.getElementsByTagName('h1')[0].style.display = 'none';
like image 168
Matt Cain Avatar answered Nov 11 '22 23:11

Matt Cain