I’m getting an unexpected error in which I am having a slightly annoying time debugging.
The error I get is this:
Uncaught SyntaxError: Unexpected token }
This is the HTML:
<html>
<head>
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<form class="search" action="search" method="get">
<input type="text" id="search-string" />
<button type="button" onclick="return clearInputValue( $("#search-string") )">
<span class="clear-icon"></span>
</button>
</form>
<script>
var clearInputValue = function(a) {
// Ultimately I will check if the object passed to this function has a value greater than 1, and if so, I will clear the input
return false;
};
</script>
</body>
</html>
You need to use a different set of quotes.
Note the single quotes.
Also, as a side note, inline javascript is discouraged. It’s much better to keep your content (html) separated from your behaviour (javascript), just as you do with your presentation (css).