Get Iframe Content As String November 28, 2023 Post a Comment I use a jquery plugin for generating rich text editor. That editor generates an structure like this: ... Solution 1: In SCEditor to fetch the value of the rich text box, you have to use the .val methodval() Since: 1.3.5Gets the current value of the editor.This will return the filtered HTML from the WYSIWYG editor or the unfiltered contents of the source editor.If using a plugin that filters the HTML like the BBCode plugin, this will return the filtered HTML or BBCode in the case of the BBCode plugin.Syntaxvar val = instance.val();Return Type: StringThe filtered value of the editorSolution 2: jQuery objects are array like objects, and you can access the innerHTML property by index (take a look at the console output): console.log($('iframe')[0].innerHTML);Copy<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="editor"><iframe><!DOCTYPE html><html><head></head><body> some important content here and I need to get them </body></html></iframe></div>CopySolution 3: Try :var contain = document.getElementById('iframe').contentWindow.document.body.innerHTML ; // Use contain where need .CopyNote : Work only if the iframe source is in the same domain.Solution 4: I hope this helps:// Gives you the DOM element without the outside wrapper you want $('.classSelector').html() // Gives you the inside wrapper as well $('.classSelector')[0].innerHTMLCopy Share Post a Comment for "Get Iframe Content As String"
Post a Comment for "Get Iframe Content As String"