[wp-meta] [Making WordPress.org] #2547: Review form; structure of star ratings

Making WordPress.org noreply at wordpress.org
Wed Feb 28 23:57:59 UTC 2018

#2547: Review form; structure of star ratings
 Reporter:  anevins         |       Owner:
     Type:  defect          |      Status:  new
 Priority:  normal          |   Milestone:
Component:  Support Forums  |  Resolution:
 Keywords:  needs-patch     |

Comment (by anevins):

 The JS (excuse the formatting in Trac).

 var ratings = $('.rate'),
     // Define a class that we will add for a selected state
     selectedClass = 'js-rating-selected';

 // If the ratings exist on the page
 if (ratings.length !== 0) {
     // Get the input fields with the shared 'name' attribute with
 'ratings' value
         var inputs = ratings.find('input[name="rating"]');

         // Watch those input fields for any state change, if the user
 selects one
     inputs.on('change', function(event) {
                                 // Get the current selected input
                                 var thisInput = $(event.target),

       // Get all the inputs before the current one
       previousInputs = thisInput

       // Get all the inputs after the current one
       nextInputs = thisInput

                         // Reset the selected class

       // Add a selected class to all the previous inputs

       // Remove the selected class to all next inputs

Ticket URL: <https://meta.trac.wordpress.org/ticket/2547#comment:3>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org

More information about the wp-meta mailing list