Problems with Javascript

-2

Hello, I'm programming my site in c9.io and I'm using a cont shown here at this link: How to add +1 in a countable variable to each click?

But in the line of Js, $ is not defined, fix it, or add global $. When I shoot the $ does not work and when I keep it off. How could I fix it?

var count = 0;
$('#addCount').click(function(){
  alert(count);
  count++;
          <input type=button id=addCount value="Adicionar Count">

FOLLOW THE SITE LINK link

    
asked by anonymous 15.10.2016 / 19:49

1 answer

1

Try this, now, you could use database to save the likes! Or a system with files!

var like = $("#likes").text();

$("#addLike").click( function() {
  
$("#likes").text(like++);
  
  
  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<h2>Sistema de likes</h2>

<button class="btn" id="addLike">Like</button>

<h1 id="likes">0</h1>
    
15.10.2016 / 20:30