0

I have a text editor on my form. When I click something in textarea same value displayed in popup of textarea column.

This is my textarea where I have to set result:

<textarea name="content" class="text_editor" id="textarea" ></textarea> 

View page where I have to get result:

<div class="form-group mod_mr20"> <label class="col-md-3 control-label">Notice Description</label> <div class="col-md-9 col-md-offset-1 hidden_color"> <p></p>//display view here </div> </div> 

This is my preview button:

<button class="btn btn-primary mr5" data-toggle="modal" type="button" name="submit" data-target="#pre_view" >PREVIEW</button> 

After display view result in popup user isn't allowed to edit those values

7
  • What is the HTML code of your pop up? Please explain things clearly. Also, you've tagged jQuery so show us what jQuery code you've tried so far. Commented Sep 28, 2016 at 5:10
  • Just use $('#textarea').val(), for example. Also add what you tried in the question, not as a comment. Commented Sep 28, 2016 at 5:13
  • As soon as you type something in the textarea, is it supposed to show the pop up immediately? Where exactly is the pop up code, though? Commented Sep 28, 2016 at 5:14
  • <div class="col-md-9 col-md-offset-1 hidden_color"> <p></p> </div> this is my popup code for textarea Commented Sep 28, 2016 at 5:17
  • which text-editor are you use? Commented Sep 28, 2016 at 5:21

2 Answers 2

1

If you use boostrap try this code:

$(document).on('show.bs.modal','#Your-modal-popup-id', function () { alert('hi'); $(e.currentTarget).find('.hidden_color p').html($("#textarea").val()); }) 
Sign up to request clarification or add additional context in comments.

Comments

0

Please try this,

I think you are trying to get this,

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script> $(document).ready(function(){ $("#preview").on('click',function(){ $('.col-md-9.col-md-offset-1.hidden_color > p').html($('#textarea').val()); }); }); </script> <textarea name="content" class="text_editor" id="textarea" ></textarea> <button type="button" class="btn btn-info btn-lg" id="preview" data-toggle="modal" data-target="#myModal">Preview</button> <!--Your Model--> <div class="form-group mod_mr20"> <label class="col-md-3 control-label">Notice Description</label> <div class="col-md-9 col-md-offset-1 hidden_color"> <p></p>//display view here </div> </div> 

7 Comments

i already have popup when i click on preview button..i just want to display data when user enter something in text area box it display same content when i click preview button..
In above it is showing the same Text entered in Textarea when you click on Preview
ok but in view did we define id or not,i want to display view in between <p></p>these tags only
@user3663 I have updated the answer please try this now
when i click on preview nothing is happened
|