Bootstrap 5 star rating example using jQuery star rating plugin – onlinecode
In this post we will give you information about Bootstrap 5 star rating example using jQuery star rating plugin – onlinecode. Hear we will give you detail about Bootstrap 5 star rating example using jQuery star rating plugin – onlinecodeAnd how to use it also give you demo for it if it is necessary.
Bootstrap 5 star rating example using jQuery star rating plugin
In this Bootstrap Tutorial, I am going to tell you how to add a star rating widget with the help of jQuery star rating plugin.
Using this bootstrap star rating plugin, you do not need to learn anything about its configuration.
You will need to include the library (Latest jQuery) only in website and add a class for star rating to an input field [input ]
.
You can customize the size of stars using Bootstrap class : xl
, lg
, md
, sm
, and xs
.
You can add read only attribute to input field to show stars with its rating only and will not change on mouse over.
It’s very easy to implement jQuery star rating plugin that automatically converts number input field to star rating widget.
index.html
<!DOCTYPE html> <html> <head> <title>Bootstrap 5 star rating example using jQuery star rating plugin</title> <linkhref="http://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css"rel="stylesheet"> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script> <linkrel="stylesheet"href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.2/css/star-rating.min.css"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.2/js/star-rating.min.js"></script> </head> <body> <divclass="container"> <h2>Bootstrap 5 star rating example using jQuery star rating plugin</h2> <br/> <labelfor="input-1"class="control-label">No stars yet:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="0"data-min="0"data-max="5"data-step="0.5"data-size="xs"> <br/> <labelfor="input-1"class="control-label">One star:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="1"data-min="0"data-max="5"data-step="0.5"data-size="xs"> <br/> <labelfor="input-1"class="control-label">Two stars:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="2"data-min="0"data-max="5"data-step="0.5"data-size="sm"> <br/> <labelfor="input-1"class="control-label">Three stars:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="3"data-min="0"data-max="5"data-step="0.5"data-size="md"> <br/> <labelfor="input-1"class="control-label">Four stars:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="4"data-min="0"data-max="5"data-step="0.5"data-size="lg"> <br/> <labelfor="input-1"class="control-label">Five stars:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="5"data-min="0"data-max="5"data-step="0.5"data-size="xl"> <br/> <labelfor="input-1"class="control-label">Read only stars:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="3"data-min="0"data-max="5"data-step="1"data-readonly="true"data-size="xl"> <br/> <labelfor="input-1"class="control-label">Hide clear icon:</label> <inputid="input-1"name="input-1"class="rating rating-loading"value="3"data-show-clear="false"data-show-caption="true"> </div> <script> $("#input-id").rating(); </script> </body> </html>
Hope this code and post will helped you for implement Bootstrap 5 star rating example using jQuery star rating plugin – onlinecode. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs