I need to create a collapse box on a page. I have added the links of the css and the scripts in the template and the html codes inserted in the richtext editor. However the display is not good as it is taking only the css and not the scripts.
Is it possible to add a jquery via a richtext editor?
If yes, how? If no, is there any other alternative instead of inserting it in the template?
It's not a good idea to add functionality like this in the rich text editor.
You should reference the jquery library in your template in the <head> section.
Once it's referenced there and you have the needed css classes in place in your markup you should be able to perform any JavaScript magic you would like.
In fact, that's what i did... "reference the jquery library in your template in the <head> section." and "needed css classes in place in your markup"... but still it not reading the scripts.Only the css appears to be ok.
I have checked it outside Umbraco, same thing, it works out fine.
Ok, do you place the classes in directly in the markup in the rich text editor? Because then I think that might be the issue since they're probably being stripped once your content is saved perhaps?
So have you checked the rendered HTML to see if the classes are in fact there? How did you add them? By adding them directly in the HTML view in the RTE or by selecting them from the styles dropdown? (This requires you have defined them in the stylesheet folder in the settings section).
I have checked the rendered HTML, and in fact, one of the DIV was removed each time i saved. So what I have done is that i have hardcoded part of the codes in the template and inserted only the collapse DIVs in the HTML view of the RT editor. Now it works FINE!!
The rule of thumb is that there should not be inserted code directly into the rich text editor ever since it's only meant for content.
If you need to make something advaned you could either consider creating a macro for use in the RTE where you can place the code needed to create the effects or you could consider enabling the template plugin for tinymce.
Adding Jquery via a Richtext editor
Hi everybody,
I need to create a collapse box on a page. I have added the links of the css and the scripts in the template and the html codes inserted in the richtext editor. However the display is not good as it is taking only the css and not the scripts.
Is it possible to add a jquery via a richtext editor?
If yes, how? If no, is there any other alternative instead of inserting it in the template?
Hi Nite
It's not a good idea to add functionality like this in the rich text editor.
You should reference the jquery library in your template in the <head> section.
Once it's referenced there and you have the needed css classes in place in your markup you should be able to perform any JavaScript magic you would like.
Hope this helps.
/Jan
Hi Jan,
Thanks for helping.
In fact, that's what i did... "reference the jquery library in your template in the <head> section." and "needed css classes in place in your markup"... but still it not reading the scripts.Only the css appears to be ok.
I have checked it outside Umbraco, same thing, it works out fine.
I'll try it again!!
Hi Nite
Ok, do you place the classes in directly in the markup in the rich text editor? Because then I think that might be the issue since they're probably being stripped once your content is saved perhaps?
/Jan
yep dat's what i did Jan!!
But the display seems good, only the scripts which need to make the box collapse is not working.
Is there anything else that can be done?
Hi Nite
So have you checked the rendered HTML to see if the classes are in fact there? How did you add them? By adding them directly in the HTML view in the RTE or by selecting them from the styles dropdown? (This requires you have defined them in the stylesheet folder in the settings section).
/Jan
Hi Jan,
I have checked the rendered HTML, and in fact, one of the DIV was removed each time i saved. So what I have done is that i have hardcoded part of the codes in the template and inserted only the collapse DIVs in the HTML view of the RT editor. Now it works FINE!!
Thanks a lot Jan
Hi Nite
Glad to hear you got it working.
The rule of thumb is that there should not be inserted code directly into the rich text editor ever since it's only meant for content.
If you need to make something advaned you could either consider creating a macro for use in the RTE where you can place the code needed to create the effects or you could consider enabling the template plugin for tinymce.
/Jan
Hi Jan,
Got it now. Next time i'll try to use macro or the plugin for tinymce.
Thnx a lot for your help!
is working on a reply...