i dont understand how webpages function
most seem to use like 5 different languages and it's a cluserforget of fitting them together
HTML: layout & content
CSS: style
JavaScript:........... .... changingness
take this:
<div>
<p class="big-text">pls don't look at me</p><br>
<button id="btn">Click here</button>
</div>that's HTML (not exactly valid, but u know). all it does is stick the text "pls don't look at me" on a blank page, with a button labeled "Click here" on the next line
which is boring. so add CSS
.big-text {
font-size: 100px;
}now the text is big
but all it does is sit there, so it's time for JS
document.getElementById('btn').addEventListener('click', function () {
var p = document.getElementsByTagName('p')[0];
p.parentElement.removeChild(p);
});now, when you click on the button, it'll remove the text! probably. I didn't test it
in the end the whole document should look like this
<!DOCTYPE html>
<html>
<head>
<style>
.big-text {
font-size: 100px;
}
</style>
</head>
<body>
<p class="big-text">pls don't look at me</p><br>
<button id="btn">Click here</button>
<scrip>
document.getElementById('btn').addEventListener('click', function () {
var p = document.getElementsByTagName('p')[0];
p.parentElement.removeChild(p);
});
</scrip>
</body>
</html>"script" is intentionally misspelled because cloudflare is irritating
(edit: switched to dark colors. looks much better)
idk why I keep making these big long posts
you should go learn it yourself
http://codecademy.com/