Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Fontawesome Star Bootstrap Review Form"
Bootstrap 4.1.1 Snippet by
jamessc0tt
4.1.1
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
1.9K
 
0 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> <div class="container"> <div class="card" style="margin-top:15px;"> <div class="card-body"> <h5 class="text-dark">Submit A Review</h5> <p class="text-secondary">We pride ourselves on being there when you need us most. Your honest feedback helps our team improve.</p> <div class="star-area"> <h1> <i class="fa fa-star-o" aria-hidden="true" id="star_review" data-number="1"></i> <i class="fa fa-star-o" aria-hidden="true" id="star_review" data-number="2"></i> <i class="fa fa-star-o" aria-hidden="true" id="star_review" data-number="3"></i> <i class="fa fa-star-o" aria-hidden="true" id="star_review" data-number="4"></i> <i class="fa fa-star-o" aria-hidden="true" id="star_review" data-number="5"></i> </h1> </div> <div class="review-area" style="display:none;"> <form> <input type="hidden" name="stars" id="star_input" value="0"> <textarea class="form-control" rows="3" style="resize: none"></textarea> <span class="float-right" style="margin-top:15px;line-height:35px;"> <span id="stars_confirm"> </span> <button class="btn btn-success float-right" type="submit" style="margin-left:20px;">Submit</button> </span> </form> </div> </div> </div> </div>
.star-area { text-align:center; } .fa-star-o { color: #212529; cursor: pointer; } .fa-star { color: #FFD700; cursor: pointer; }
$( document ).ready(function() { document.querySelectorAll('#star_review').forEach(function(element) { element.addEventListener("mouseenter", function(event) { $('#stars_confirm').html(''); var stars = event.target.dataset.number; $('#star_input').val(stars); var count = 0; document.querySelectorAll('#star_review').forEach(function(el) { if (count < stars) { $(el).removeClass('fa-star-o'); $(el).addClass('fa-star'); $('#stars_confirm').append('<i class="fa fa-star" aria-hidden="true" style="color:#212529 !important"></i>'); } else { $(el).removeClass('fa-star'); $(el).addClass('fa-star-o'); } count = count+1; }); }); element.addEventListener("click", function(event) { console.log('clicked') $('.star-area').hide(); $('.review-area').fadeIn(); }); element.addEventListener("mouseleave", function(event) { document.querySelectorAll('#star_review').forEach(function(el) { $(el).removeClass('fa-star'); $(el).addClass('fa-star-o'); }); }); }); });
Related:
See More
Free Template
Now UI Kit
464.1K
45
login-form
170.9K
18
Login Form
142.2K
51
Contact Form
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76