I have looked around and couldn't get a straight answer regarding my basic problem.
We have a site which applies a bunch of basic css classes to elements using jQuery in document.ready(). This works fine at first.
But now we have also started using JSF 2.0 with facelets and have a few f:ajax tags that rerender parts of the page based on events. As you can imagine the rerendered parts display without these styles because the jQuery function is not called again during the ajax call.
I have now played around and found that you can add onevent to f:ajax and force the main jQuery function to be called again. But this doesn't feel very elegant and I need to add it to all f:ajax tags. Plus I'm experiencing some unexplained behaviour.
So my questions are:
- Does it still make sense to apply style classes in document.ready()? Or is it bad practise in this instance? Should I simply add the classes to the elements?
- Is jQuery ajax a viable alternative to f:ajax?
Any opinions or help or guidance would be very much appreciated.
Thanks