Question

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:

alert(("textarea[title='Requirements']").find("*").find("body").html());

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

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.

Was it helpful?

Solution

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 of iframe

If you want to get content of div, then do

find("div").html()

After body find.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top