SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jRating Starscript still working?

    Hey guys,

    I wanted to implement this star rating script but I cant get the jquery to work. I uploaded the 2 .js files, the min.js file the .css file and the 3 pictures to my host account. Then I changed the path from jquery/...js to ...js.

    Using the following code all the page displays is "Hi"

    Code:
    <html>
    <head>
    <meta charset = "utf-8">
    <link rel="stylesheet" href="jRating.jquery.css" />
    <script type = "text/javascript" src ="jquery.js"></script>
    <script type = "text/javascript" src ="jRating.jquery.js"></script>
    <script type = "text/javascript">
    $(function(){
               $(".rating").jRating({
    		   decimalLength: 1,
    		   rateMax: 5
    		   
    		   });
    })
    </script>
    </head>
    <body>
     <div class="rating">Hi</div>
     
    </body>
    </html>
    Anyone know if the script is still working?

    Thank you
    Shibbs

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgot to post the link.

    http://www.myjqueryplugins.com/jRating

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Shibbs View Post
    Anyone know if the script is still working?
    Yes, it does. jRating demo
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a sample initialisation from their documentation.
    Code:
    <!-- JS to add -->
    <script type="text/javascript">
      $(document).ready(function(){
    	$(".basic").jRating();
      });
    </script>
    That's not what you chose to do. Your code is looking for elements that have yet to be rendered.
    Tab-indentation is a crime against humanity.

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Logic Ali View Post
    Here is a sample initialisation from their documentation.
    Code:
    <!-- JS to add -->
    <script type="text/javascript">
      $(document).ready(function(){
    	$(".basic").jRating();
      });
    </script>
    That's not what you chose to do. Your code is looking for elements that have yet to be rendered.
    No, his code seems to be fine in that regard. $(function () { ... }); does the same job as $(document).ready(function () {...});

    See http://api.jquery.com/jQuery/#jQuery3
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies

    I think I did something wrong during the upload process. If I just upload the (i) jRating.jquery.min.js , (ii) the jquery.js and the (iii) jRating.jquery.css and put them into a folder called jquery.

    And change the 3 lines to

    Code:
    <link rel="stylesheet" href="jquery/jRating.jquery.css" />
    <script type = "text/javascript" src ="jquery/jquery.js"></script>
    <script type = "text/javascript" src ="jquery/jRating.jquery.js"></script>
    then it should work?

    It seems like the paths in the java documents all require a jquery/.. in front of the file unless I change it.

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Shibbs View Post
    I think I did something wrong during the upload process. If I just upload the (i) jRating.jquery.min.js , (ii) the jquery.js and the (iii) jRating.jquery.css and put them into a folder called jquery.
    We can help you to figure out what the problem is, but in order to do that we need you to link us to a page of yours that is experiencing the problem.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I sent you a private message with the link to my site.
    I really appreciate your help.

  9. #9
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Shibbs View Post
    I sent you a private message with the link to my site.
    I really appreciate your help.
    Thanks for the link - the problem that you're having is in relation to the id attribute. See http://www.myjqueryplugins.com/jRating
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  10. #10
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting, I changed the div field to id"1_1" and it still didnt work. Then I removed the "Hi" and it worked.
    Thanks a lot, saved me a ton of time.
    Appreciate it


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •