Comments (6)
In that case, try doing something like this when initializing the plugin:
$(document).on("rateit", ".rateit", function() { ... }); // .rateit here is the selector for the div element that you created that holds the stars
The idea here is to bind to the document itself (which always exists) so that the target element is determined at runtime instead of at DOM-load time. I do this kind of thing all the time when creating single-page web apps that are entirely AJAX-driven and where elements come and go from the DOM frequently. The binding is effectively deferred until the time that the event occurs instead of when the DOM is first loaded.
from rateit.js.
@CliqLabs , thanks for providing the explanation. Closing issue.
from rateit.js.
I know, this issue is closed. But maybe you can give me a foolproof example of how to do it? That would be very kind.
I just dont get it. Thanks in advance.
from rateit.js.
Hi @Nexotap . Please see my jsfiddle here: https://jsfiddle.net/gidon/w12zkh50/
from rateit.js.
Thank you very much. Helped me alot.
Btw. Very nice plugin 👍
from rateit.js.
Wanted to add my findings for those facing the same issue. I have a DIV that gets loaded with data via an AJAX call and includes a rateit component.
I found adding this does the trick:
$( document ).ajaxComplete(function() {
$( ".rateit" ).rateit();
});
This initializes all DOM elements of class .rateit after any AJAX calls are complete. Works great.
gjunge - thank you for this component!
from rateit.js.
Related Issues (20)
- rateit with jquery mobile HOT 8
- <td><span> error! HOT 4
- Examples page broken
- Spacing between stars with css HOT 2
- Star.gif HOT 1
- Step size with custom image star HOT 3
- Create vanilla-js implementation HOT 2
- Can script render in responsive layout? HOT 1
- Examples page request HOT 1
- tabindex on readonly is not good for accessibility HOT 8
- rateit version with wordpress version HOT 1
- Unable to get step=0.25 , It always remain 0.5 HOT 2
- Proposal for enhancement HOT 3
- dir="rtl" not working programmatically HOT 1
- Parent elements with "display: none" breaks rating bar HOT 1
- Strange behavior HOT 1
- valuesrc = index problem HOT 4
- Large formatting issue HOT 3
- How it will work with asp.net updatepanel HOT 1
- The reset button is not accessible to visually impaired users HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rateit.js.