I am using Light weight rich text editor to entering contents.After entered I was tried to get that entered contents using j-query,So that I ll use for other purposes.But it not getting.Please help me.
HTML form:
<form>
<p>
<textarea name="ta1" id="ta1" class="rte2"></textarea>
</p>
<a id="various1" href="#inline1" style="text-decoration:blink"><input type="button" id="expand" name="expand" value="Expand"></a>
<p></p>
<div id="inline1" style="width:460px;height:320px;overflow:auto;">
<p>
<textarea name="ta2" id="ta2" class="rte1"></textarea>
</p>
</div>
</form>
J-Query script:
<script type="text/javascript">
$(document).ready(function() {
$("#expand").click(function () {
var text = $("#ta1").text();
alert(text); });
//$("#various1").click(function(){
//$("#inline1").hide();
//});
Rich text editor toolbar j-query codes
var arr = $('.rte1').rte({
css: ['default.css'],
width: 450,
height: 200,
controls_rte: rte_toolbar,
controls_html: html_toolbar,
});
$('.rte2').rte({
css: ['default.css'],
width: 450,
height: 200,
controls_rte: rte_toolbar,
controls_html: html_toolbar
}, arr);
});
</script>
try with $("#ta1").val();
textareas are input types, and the content of a text area is retrieved and set with .value
and in jQuery case .val()
Use this
var text = $("#ta1").text();
see i have used .val()
instead of .text()
DEMO Here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.