Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When wanting to get the content of editor with val() it returns empty value #953

Open
xillibit opened this issue Feb 11, 2024 · 1 comment

Comments

@xillibit
Copy link

When wanting to get the content of editor in live with val() it returns empty value

Steps to reproduce the problem

  1. At start the content of the editor should empty
  2. Write something in the editor
  3. Click on a button which call sceditor.instance(document.getElementById('message')).val();
  4. It return just an empty value
@sulaiman0dawod
Copy link

sulaiman0dawod commented May 13, 2024

Simple example .

<textarea id="message" name="message" rows="20" cols="70"></textarea>
<script type="text/javascript">
var textarea = document.getElementById('message');
$("#message").sceditor(textarea);
var MyEditor = $("#message").sceditor("instance");
</script>

To view the text in PHP
echo $_POST['message'];

to Inserts HTML into WYSIWYG editor OnClick
MyEditor.wysiwygEditorInsertHtml("ddddddddd");
Insert BBcode
MyEditor.insertText("ddddddddd");

<a target='dddddd' OnClick="window.parent.PBBEditor.wysiwygEditorInsertHtml(this.target);" />
 Html Link
</a>

Complete example

<textarea id="message" name="message" rows="20" cols="70"></textarea>
<script type="text/javascript">
			var textarea = document.getElementById('message');
			var partialmode = 0;
			sceditor.create(textarea, {
			    plugins: 'undo',
				format: 'bbcode',
				bbcodeTrim: false,
				style: "sceditor/minified/themes/content/default.min.css",
			    fonts: "Arial,Arial Black,Tahoma,Droid Arabic Kufi,Georgia,Impact,Sans-serif,Serif,Times New Roman,Comic Sans MS,Courier New,Trebuchet MS,Verdana",
				{$_CONF['info_row']['content_dir']}: 'bool',
				width: "100%",
				enablePasteFiltering: true,
				emoticonsEnabled: true,
				emoticonsRoot: "sceditor/emoticons/",
				emoticons:{
				    dropdown: {
				        ':)': 'emoticons/smile.png',
				        ':angel:': 'emoticons/angel.png'
				    },
				    // Emoticons to be included in the more section
				    more: {
				        ':alien:': 'emoticons/alien.png',
				        ':blink:': 'emoticons/blink.png'
				    },
				    // Emoticons that are not shown in the dropdown but will still
				    // be converted. Can be used for things like aliases
				    hidden: {
				        ':aliasforalien:': 'emoticons/alien.png',
				        ':aliasforblink:': 'emoticons/blink.png'
				    }
				},
              emoticonsCompat: true,
			    toolbar: "bold,italic,underline,strike|right,center,left,justify|font,size,color,removeformat|cut,copy,pastetext|bulletlist,orderedlist|table|codebrush,quote|horizontalrule,{$mention}image,email,link,unlink|emoticon,youtube,video|bbcodeslist|ltr,rtl|print,maximize,source",

});
$(function() {
	$("#message").sceditor(textarea);
	MyEditor = $("#message").sceditor("instance");

});
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants