Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nite 9 posts 29 karma points
    Jul 12, 2011 @ 12:14
    Nite
    0

    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?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 12, 2011 @ 12:21
    Jan Skovgaard
    0

    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

  • Nite 9 posts 29 karma points
    Jul 12, 2011 @ 12:30
    Nite
    0

    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!!

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 12, 2011 @ 12:46
    Jan Skovgaard
    0

    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

  • Nite 9 posts 29 karma points
    Jul 12, 2011 @ 12:52
    Nite
    0

    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?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 12, 2011 @ 13:14
    Jan Skovgaard
    0

    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

  • Nite 9 posts 29 karma points
    Jul 12, 2011 @ 13:46
    Nite
    0

    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

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 12, 2011 @ 14:07
    Jan Skovgaard
    0

    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

  • Nite 9 posts 29 karma points
    Jul 13, 2011 @ 06:56
    Nite
    0

    Hi Jan,

    Got it now. Next time i'll try to use macro or the plugin for tinymce.

    Thnx a lot for your help!

Please Sign in or register to post replies

Write your reply to:

Draft