Issue with emojioneArea

Eric Zwar
Eric Zwar used Ask the Experts™
on
I am trying to use this jQuery plugin but I cannot retrieve the entered data and associated emoji to send these data to a database via an AJAX call.

I can see the text and the emoji in the emojioneArea in the DOM but can't figure out how to extract them into a JavaScript variable.

I believe that I have followed the guidance in the emojioneArea GitHub examples but for me it does not work.  If I try to use the setText or getText methods the browsers tell me that they are not valid functions.

The screen scrapes attached are from IE11 but I have the same issue with Firefox.

Any assistance will be most appreciated and thanking you in anticipation.

Eric

From the DOM
The code I am trying
P.S., The alert returns no data but the length is correctly one.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
More info:

If I use:

var send_length = $('.emojionearea-editor').length;
var chat_message_1 = $('.emojionearea-editor').data();
alert("length: " + send_length + " msg1: " + chat_message_1);

I get the length of one which is correct and [object Object] as the data returned.

But I do not know how to 'see' or extract what's in that object.

Again, and advice will be appreciated. Thanks, Eric.

Author

Commented:
I wrote a small PHP test program incorporating an HTML form.  I entered some text and emojis in the form textarea. The upload, via post, worked fine and I was able to then enter those data into an MySQL database table and also retrieve the same and then re-display the retrieved data in the form.

The collation for the database table is "CHARACTER SET utf8mb4 COLLATE utf8mb4_bin"

So my issue is just extracting the data from the DOM and then sending it, in my problem case, via AJAX to a PHP module which will insert the data into a MySQL database table,  with the character set and collation similarly defined.

Again, and advice will be appreciated. Thanks, Eric.
It was nothing to do with emojionearea.

In the end the data extraction solution was simple:

var data_pointer = document.getElementById('chat_entry_box');      
var chat_message = data_pointer.innerHTML;   (which probably could be done in one line of code)

But it took me ages to figure this out and it should have been easy-peasy!

My ageing years are showing :-)

Author

Commented:
Upon reflection I was 'led astray' when the similar jQuery val did not return anything.

The one-liner solution:    var chat_message = document.getElementById('chat_entry_box').innerHTML;

Never too old to learn :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial