I am trying to change the class of a font awesome icon so that it changes icon when clicked. I have read several other questions (like this one and this one and this one) but have been unsuccessful in getting a working example.
In this case I am trying to change the facebook icon to a tick.
HTML:
<html>
  <head>
    <meta charset="utf-8"/>
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="./java.js"></script>
  </head>
  <body>
    <div>
      <a href="javascript:void" rel="me"><i class="fa fa-twitter-square fa-3x"></i></a>
      <a id="facebookicon" href="javascript:void" rel="me"><i class="fa fa-facebook-square fa-3x"></i></a>
    </div>
  </body>
</html> 
Javascript:
$('#facebookicon').click(function(){
    $(this).find('i').toggleClass('fa-facebook-square fa-check-square')
});
I have also tried this Javascript code:
$('body').on('click', '#facebookicon', function(){
   $('i').toggleClass('fa-facebook-square fa-check-square');
});
When I click of the icon I get a syntax error in the console:
SyntaxError: expected expression, got end of script
I think this relates to the javascript:void but i'm not sure. When I tried to fix this the answers all seem to be people having quotation marks in the wrong place or mixing and matching double and single quotes. I don't think that it is the case here.
I see many people aiming to have the toggle effect but ultimately I would like it such that it changes once and will NOT change back if clicked again.
Can someone point me in the right direction?
 
     
     
    