I'm using the jquery star rating plugin: http://www.fyneworks.com/jquery/star-rating/
I might get some html code like this:
<form name="api-disable">
<input type="radio" class="star {split:2}" name="api-readonly-test" value="1"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="2"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="3"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="4"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="5"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="6"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="7"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="8"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="9"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="10"/>
<input type="button" value="Submit »" onClick="
$(this).next().html( $(this.form).serialize() || '(nothing submitted)' );
"/>
<span></span>
</form>
This works fine, but if I try to call my own function my function doesn't alert. For example:
$('.star').click( function () {
alert('test');
});
I also tried attaching an id and making that the click function, but still no luck. If I remove the star class from the buttons then my function will work. So it seems some of the code in this plugin prevents outer functions? What would I need to do to call my own function?
From stackoverflow
-
The documentation suggests you can add a click callback, as well as some other events, when you activate that plugin:
$('.auto-submit-star').rating({ callback: function(value, link){ alert(value); } });Roger : Thanks! I forgot about that page and apparently was looking at documentation.js, which was a bunch of scrambled characters. :PKobi : Yeah, I also looked on the API page - it had nothing. Documentation is lacking for that plugin.Roger : If I add an id to each input, I can read the id in the callback function with alert($(this).attr('id')) but if the user clicks the cancel button then I can't pick anything up. I added an id to the js file in the rating-cancel link, but still no luck. Any ideas?Kobi : @Roger - sorry, I can't really follow that... Try asking a new question, and post the relevant code, I'm sure you'll get an answer. Also, if possible, consider using a plugin with better documentation, such as http://orkans-tmp.22web.net/star_rating/index.htmlRoger : Is it just me or does that have less documentation hah. Well I tried to use it and the input buttons are not even converting to stars. I'm using jquery-1.3.2. I've never used the UI before, but I attached the jquery-ui-1.7.2, and still only see input buttons.Roger : Asked the question here if your interested: http://stackoverflow.com/questions/1551016/star-rating-widget-for-jquery-ui
0 comments:
Post a Comment