![]() |
Make a h1 class innerHTML a variable
1 Attachment(s)
Using:
Greasemonkey Firefox 11.0 ---------------- I was creating a script but I came to a halt. I am trying to make a title from a movie on neflix to a variable. (see attachment) (I am going to use the movie Hannibal as an example) Code:
var netflixTitle = document.title.substring(document.title.length);Code:
<h1 id="title">This is what I want</h1>Code:
<h1 class="title">This is what I want</h1> |
I've never used greasemonkey, but in normal javascript you'd do something like this:
Code:
var tags=document.getElementsByTagName("H1"); |
Since you are using Firefox:
Code:
var theTitle = document.getElementsByClassName("title")[0].innerHTML;If that's not the case, we could do it by finding that class nested within the <div> with id="displaypage-overview-details". Thus; Code:
var theTitle = document.getElementById("displaypage-overview-details") |
Thank you Old Pedant, the
Code:
var theTitle = document.getElementsByClassName("title")[0].innerHTML; |
:thumbsup:
I forget some browsers don't need incessant hand-holding... |
| All times are GMT +1. The time now is 10:39 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.