I see four things in your code:
-
Don’t forget the
;
at the end of your jquery click event definition. -
You should use
#someDiv
instead of.someDiv
as someDiv is an Object Id, not a Object class. This was already mentioned by Wesley. -
You can’t use
this.val()
sinceval()
is not a native javascript function. You may want to use$(this).val()
which is wrapping the javascript object into jQuery. -
You need to use
$(function() { /* your code */ });
as your javascript function is defined before your HTML object will be created. This is a shortcut for$(document).ready(function () { /* your code */ });
It would be:
<script type="text/javascript">
$(function() {
$('.hover-star').click(function (){
$('#someDiv').text($(this).val());
});
});
</script>
4
solved My Jquery isn’t “throwing” anything