Take the 2-minute tour ×

I am using Bootstrap wysiwyg5 editor as a part of a form.

This text area happens to be a required field(should not be empty). I want to validate if the user has entered any value on to this field or not. I see that Bootstrap wysiwyg uses a Iframe to display the content. I tried to access the content of the iframe's body in jQuery by doing this:


but failed.

My question is: How do I check if the user has entered some text in this Bootstrap wysiwyg textarea. Please help me out.

share|improve this question
How you are initializing it? –  pvnarula Jun 6 '13 at 14:21
Unless I'm missing something, I don't see any iframes in their demo. It's just a div that is contenteditable –  Ian Jun 6 '13 at 14:22
yes, I see a iframe which it uses to display the content. –  codeMan Jun 6 '13 at 14:25
mindmup.github.io/bootstrap-wysiwyg - There is no iframe. It's <div id="editor" contenteditable="true"></div> –  Ian Jun 6 '13 at 14:32
@lan ah.. yours seem to be little different from what am using : jhollingworth.github.io/bootstrap-wysihtml5 –  codeMan Jun 6 '13 at 14:39
show 2 more comments

2 Answers

up vote 2 down vote accepted

Have you tried this question?

How to access the content of an iframe with jQuery?

The answer from the question referenced above:


Edited to add my original answer:

share|improve this answer
let me check it out! –  codeMan Jun 6 '13 at 14:24
WOW!! it worked!!only god knows how long I have been stuck with this.... thanks a lot!! –  codeMan Jun 6 '13 at 14:29
can you included the statement in your answer that u had written before, so that I can accept the answer? –  codeMan Jun 6 '13 at 14:30
What I had written before was before I realized you were referring to a iframe. Do I need to write some code in there for it to be accepted? –  asafreedman Jun 6 '13 at 14:41
Oh, that's great. Glad I could help. I'm sure we all know how it feels to spin on something when you're only a step away. I added my original answer too. –  asafreedman Jun 6 '13 at 17:39
show 2 more comments

wysiwyg editor does not works in bootstrap modal because it triggers before creating modal.. or something. so the best way to do it is triggering the modal before wysiwyg editor.

function showmymodal(){
$("#modal").html(' <div class="modal-header">
<h3 id="myModalLabel">modal header</h3></div>
<div class="modal-body">
<textarea id="textarea"></textarea>
<div class="modal-footer">
"font-styles": true, 
"emphasis": true,
"lists": true, 
"html": false, 
"link": true, 
"image": true, 
"color": true 

you can check on Tutorial website

share|improve this answer
Welcome to Stack Overflow. Please summarise the link in your answer; that way, if the link goes stale the answer won't be completely useless. –  michaelb958 Jul 8 '13 at 16:23
@Debashis Dip Thanks for your answer. That was not my concern, I was not trying make WYSIHTML5 work in a Modal. –  codeMan Jul 9 '13 at 18:00
sorry,for checking iframe val you should use $("#textarea").val(); –  Debashis Dip Jul 9 '13 at 19:30
add comment

Your Answer


