Gửi bởi
cutuan527
Mình đã tích hợp FCKEditor vào Project ASP.net MVC.
Ban đầu thì giá trị mặc định trong Textarea của FCKEditor là "hello".
Sau đó mình thay đổi nội dung trong textarea và dùng jquery để hiển thị nội dung mới này lên thì nó chỉ hiển thị ra giá trị mặc định (là hello).
Các bạn giúp mình với nhé !
Mã:
<div class="editor-field" id="fckeditor">
<%using (Html.BeginForm("Edit","Home",FormMethod.Post))
{ %>
<textarea id="temp" value="" name="content">Hello</textarea>
<input type="submit" value="Gửi" id="send" />
<%} %>
</div>
Code Jquery
Mã:
<script type="text/javascript">
$(document).ready(function () {
$('#fckeditor form').submit(function () {
var noidung = $('#temp').attr('value');
alert(noidung);
return false;
});
});
</script>
textarea có thuộc tính value ?
bạn sửa lại thành
Mã:
$(document).ready(function () { $('#fckeditor form').submit(function () { var fck = $("#temp___Frame").contents().find("#xEditingArea iframe").contents(); var noidung = fck.find("body").html(); alert(noidung); return false; }); });
Để xem rõ cấu trúc bạn dùng firebug
Pallet nhựa Lâm Đồng giải pháp hoàn hảo cho nhà kho Pallet nhựa Lâm Đồng là một giải pháp đa năng và hiệu quả trong việc vận chuyển và lưu trữ hàng hóa. Trong đó, pallet nhựa Lâm Đồng không chỉ đáp...
Pallet nhựa Lâm Đồng giải pháp...