I'm basically trying to do this: LINK, now, I've used Marc's methods before and SPServices etc, so it must be something ruddy stupid on my part, because everything else from him has worked without issue (thanks Marc BTW!)

So I'm trying use the same method described there to see if there's anything in the rich text column, check the length and fire my validation stuff.

I'm unable to replicate Marcs method and I've tried various creations of my own, some a bit hopeful I'll admit, what hasn't worked is this for example:


I wonder if because I've altered my forms a little, that may be the reason the code doesn't work 'out of the box', here's a screenshot of my html:

My HTML, replicating Marc's examaple from his blog

Could anyone steer me towards a solution?

The code that is suggested by Marc to read the contents of the text box is:

var systemInformation = $("textarea[Title='Requirements']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("body").html();

Which I can't get to work... for info, the error message is simply

"Object doesn't support this property or method" on all variations that I try to run.

  • Try this var systemInformation = $("iframe[Title='Rich Text Editor']").contents().find("body").html(); Dec 5, 2014 at 17:29
  • Thanks Amal, I haven't tried the code, but as there are multiple iframes with that title I think it won't cover it, needs to be specific to the 'requirements' text box. Dec 6, 2014 at 9:57
  • Ok, in that case you can directly use the id of the iframe and use it like $('#ct100_PlaceHolderMain_g_77ed0a4b_ee91_48e3_2b152a3cde83_ff11_1...).contents().find("body").html();, make sure you replace... with the complete id if iframe Dec 6, 2014 at 12:31
  • Thanks again, I'll check the iframe ID remains constant when in the office and report back, cheers. Dec 6, 2014 at 12:34
  • That's worked! :) The ID's are always unique for each box and remain constant between sessions etc. I ran this to test: console.log($('#ctl00_PlaceHolderMain_g_77ed0a4b_ee91_48e3_a43b_2b152a3cde8e_ff11_1_ctl00_ctl00_TextField_iframe').contents().find("body").html()); which returned <DIV>test text</DIV>. Now I just need to remove the DIV's and I've got what I need, I'll figure that out. Thanks very much Amal - BTW how do I now mark your suggestion as the answer? Dec 7, 2014 at 12:22

1 Answer 1


In that case you can directly use the id of the iframe and use it like


make sure you replace... with the complete id of iframe

If you want to get content of div, then do


After body find.

  • Here I am in 2017 really appreciating your answer! This worked perfectly, thank you.
    – Caola
    Jul 6, 2017 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.