<!--The heading text is below. It is class h1 (heading 1) and I have given it its own id of 'title'-->
<h1 id="title">
Native Apps vs. Web Apps: The Great Debate Pt. 3 of
</h1>
<!--below is the button-->
<button onclick="killLindsay()">Kill Lindsay</button>
CSS
/* the information below will affect all the elements of the HTML that are h1 (heading 1) */
h1 {
font-family: Helvetica, Arial, sans-serif; /* remove Helvetica */
font-size: 3.0em; /* try another size */
font-style: normal; /* try italic */
color: blue; /* try another colour */
text-shadow: -2px 2px 3px green; /* change the numbers or colour */
}
JavaScript
// this is our basic title, assigned to 'baseText':
var baseText = "Native Apps vs. Web Apps: The Great Debate Pt. 3 of ";
// this is how many parts we've got so far, assigned to 'howManyParts':
var howManyParts = 3
// this runs when you press the button
function killLindsay()
{
// this gets the element with id 'heading' (look up at the HTML) and sets it to baseText + howManyParts
document.getElementById("title").innerHTML = baseText+howManyParts;
// this increases the number of parts for the next time you press the button:
howManyParts += 1;
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.