I have the following script in newedit.js file.
$(document).ready(function() {
$("[id^=save]").click(function() {
$("#scholarship-short_desc").val("test");
alert($("#scholarship-short_desc").val());
$("form").submit();
});
$("#scholarship-short_desc").ckeditor();
});
I also have the following entries in my html file. I'm using ckeditor 3.6.5.
<script src="/myapp/javascripts/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="/myapp/javascripts/ckeditor/adapters/jquery.js" type="text/javascript"></script>
<script src="/myapp/javascripts/scholarships/newedit.js" type="text/javascript"></script>
This displays the ckeditor correctly in my page. But when I try to set the textarea's value using a val function (as described here (ckeditor's jquery guide)), the value is not being set.
Any ideas? thanks! :)
saveis a button in form,submitisn't doing anything that browser default isn't already doing...and will cause a page refresh. Look and see if it isn't being refreshed. You have to use ajax to avoid this