Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Since the inputs are converted to divs (with the 'rated stars' being assigned a different class), I think you'll want to count the number of divs with the <code>.star-rating-on</code> class and assign that value to the input, like this:</p> <pre><code>$('.star-rating').click(function() { // assign the value of "total stars" to a textbox with an id of ratingText $('#ratingText').val($('.star-rating-on').length); }); </code></pre> <p>Boring looking example - without the actual graphics/animations (just the HTML from the transformed inputs on plugin page - the value will always be 4): <a href="http://jsfiddle.net/bhf2d/" rel="nofollow">http://jsfiddle.net/bhf2d/</a></p> <p><strong>EDIT</strong></p> <p>The code above should work. I think you may be thinking that you need to apply your jQuery to the radio button, but that's not the case, since it is swapped out on page load with a div. Just in case you're not clear, I've added a live example using the code you provided in your question: <a href="http://bjornthomson.com/testtabs/star-rating/index.html" rel="nofollow">Click here to see it</a>.</p> <p><strong>EDIT 2</strong></p> <p>See <a href="http://bjornthomson.com/testtabs/star-rating/index2.html" rel="nofollow">an updated version here</a>, matching the additional requirement to set multiple checkboxes. The textboxes have been renamed slightly (InsRatingText0 etc) to facilitate easily adding more items. The name convention <code>InsRatingText[n]</code> is set that way to match the div classes the plugin adds dynamically ('rater-0', 'rater-1', etc) </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload