Vote count:
0
I am making a simple app that increases the count below each picture on click. I think it's having an issue compiling or I'm missing something silly and obvious.
Heres my HTML and JS
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Cat Clicker</title>
<script src="http://ift.tt/183v7Lz"></script>
<script src='app.js'></script>
<script src="http://ift.tt/14Xeh1X"></script>
</head>
<body>
<h1> Cat Clicker </h1>
<img class="catpic_one" src="cat.jpg" alt="Mountain View" style="width:304px;height:228px">
<p class="counter_one"> 0 </p>
<img class="catpic_two" src="catpic2.jpg" alt="Mountain View" style="width:304px;height:228px">
<p class="counter_two"> 0 </p>
</body>
</html>
JS
$(document).ready(function() {
var clicks_one = 0;
var clicks_two = 0;
$('#catpic_one').on("click", "#counter_one", function() {
clicks_one++
var clickcount_one = clicks_one.toString();
$('#counter_one').append("You clicked the cat #1" clickcount_one " times.");
}
$('#catpic_two').on("click", "#counter_two", function() {
clicks_two++
var clickcount_two = clicks_two.toString();
$('#counter_two').append("You clicked the cat #1" clickcount_two " times.");
}
});
asked 40 secs ago
Is my bracketing the issue here? Or is there really an unexpected identifier? Javascript/jQuery
Aucun commentaire:
Enregistrer un commentaire