Hi Everyone,
I have an anchor tag like below.
<a href="#" class="show-link">Read More</a>
When user clicks 'Read More' button, it executes below JS code and display hidden text.
$('.expand .show-link').click(function(){
globalExpanded = true;
var obj = $(this).parents('.expand');
if ($(obj).hasClass('expanded')) {
$(obj).removeClass('expanded');
$('.hidden-content',obj).slideUp('fast');
$(this).text('Read More');
} else {
$(obj).addClass('expanded');
$('.hidden-content',obj).slideDown('fast');
$(this).text('Less');
}
return false;
});
I want to see hidden content when 'read More' is clicked.( inorder to edit hidden content ).
Eventhough I made 'Read More' not editable, CKEditor is not executing above JS inorder to show the hidden content.
Thanks in advance !!!
-Vinay
There is a very good reason
There is a very good reason for it being like this. If inline javascript were allowed to write to the document whilst it is open for editing, and you then saved, you would overwrite the original file with a copy containing the javascript's output instead of the script code. That would be bad.
The workaround we use is to 'escape' javascript by wrapping it in textarea fields before letting the editor loose on the page. That way the javascript can be seen and edited online, but doesn't get to run and alter the page being edited.
Either way, though, you need to test scripting outside of the editor.