I am trying to program a WYSIWYG for an app. Everything seems to be okay , except that I can't get the value of the iframe, without the [object HTMLBodyElement]
let content = this.richtextarea.nativeElement.contentDocument.body
When I console.log(content)
, I get <body>...</body>
but trying to store it to database, it says its an [object HTMLBodyElement]
.
I have tried converting the iframe value to a string but not luck.
How can I get the value of the iframe as a string?
Is the any better way of doing this, for instance moving the value of the Iframe to a textarea then get the textarea value in component class?
I solved it by using inner HTML
this.richtextarea.nativeElement.contentDocument.body.innerHTML
Hope this helps you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.