-3

In an alert() I'm getting [object object]. I'm wondering for not getting the values in the <div>.

var popUser = $("<div/>").attr("id", "jchat_user_" + ae + "_popup").addClass("jchat_tabpopup jchat_tabopen").attr("dir", "ltr").html(toolbarLanguageHTML + '<div class="jchat_tabcontent messagelist"><div class="jchat_tabcontenttext private"></div><div class="jchat_tabcontentinput">' + writeElement + "</div>" + webrtcTrigger + '<div class="jchat_trigger_emoticon"></div><div class="jchat_trigger_fileupload"></div><div class="jchat_trigger_export"></div><div class="jchat_trigger_delete"></div><div class="jchat_trigger_refresh"></div>' + infoTrigger + historyTrigger + geolocationTrigger + sendTrigger + "</div>").appendTo($("body"));

alert(popUser);

1 Answers1

0

you are assigning an object (DOM element) to your

var popUser

thats why alert showing [object object].

If you want to show your HTML markup in alert than You can't do this in standard alert box. You'll have to create your own, for example, jQuery UI Dialog: https://jqueryui.com/dialog/

or you can use console.log() to check popUser object for your development purposes.

santoshe61
  • 805
  • 8
  • 17