Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Based on the comments and on this fiddle <a href="http://jsfiddle.net/45AEY/" rel="nofollow">http://jsfiddle.net/45AEY/</a>:</p> <pre><code>&lt;h3 class="bar"&gt;Beginners&lt;/h3&gt; &lt;div class="content"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#/routes/1"&gt;Route 1&lt;/a&gt; &lt;div id="Route1" class="rate_widget"&gt; &lt;div class="star_1 ratings_stars" data-score="1"&gt;1&lt;/div&gt; &lt;div class="star_2 ratings_stars" data-score="2"&gt;2&lt;/div&gt; &lt;div class="star_3 ratings_stars" data-score="3"&gt;33&lt;/div&gt; &lt;div class="star_4 ratings_stars" data-score="4"&gt;44&lt;/div&gt; &lt;div class="star_5 ratings_stars" data-score="5"&gt;55&lt;/div&gt; &lt;/div&gt; &lt;div class="total_votes"&gt;vote data&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>As there are no <code>data-route_id</code> attributes, I believe the <code>route_id</code> you are trying to catch is the number of the <code>Route</code> of the parent <code>div</code> (in the example above, the parent <code>div</code> is <code>&lt;div id="Route1" class="rate_widget"&gt;</code>.</p> <p>In that case, this line</p> <pre><code>var route_id = $(this).attr("data-route_id"); </code></pre> <p>Can be switched to this line:</p> <pre><code>var route_id = $(this).parent().attr('id').replace('Route',''); </code></pre> <p>And <code>route_id</code> will have the ID of the route. (In the example above it'll be <code>1</code>).</p> <p>Give it a go: <a href="http://jsfiddle.net/2B9GM/" rel="nofollow">http://jsfiddle.net/2B9GM/</a></p> <p><sup><strong>Ps.: In your original fiddle, you did not set jQuery as library. Make sure you have it set in your fiddles and, more importantly, imported (through the <code>script</code> tag) in your HTML page.</strong></sup></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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