Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-02-2009, 10:23 PM   PM User | #1
StealthRT
Regular Coder

 
StealthRT's Avatar
 
Join Date: Aug 2006
Posts: 175
Thanks: 13
Thanked 0 Times in 0 Posts
StealthRT can only hope to improve
Question Help with star rating

Hey all i need some help with finding out how i can SET the star rating in this code:
Code:
//hook up the click event
      star.click(function() {
        //When clicked, fire the 'ratingchanged' event handler.  Pass the rating through as the data argument.
        elements.triggerHandler("ratingchanged", {rating: this.rating});
        containerElement.rating = this.rating;
      });
The code works fine if i move my mouse over the stars and click. After doing that it sets the stars number. What i want to do is set it automatically when the page loads.

How can i call those two functions from my page to set the stars?

I've tried:
Code:
$(document).ready(function() {
     $('#raing-1').ratings(7).bind('ratingchanged', function(event, data) {
     //alert(data.rating);
     elements.triggerHandler("ratingchanged", {rating: 2});
     containerElement.rating = 2;
});
});
But it doesnt set anything.

Any help would be great!

David
StealthRT is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:02 AM.


Advertisement
Log in to turn off these ads.