[英]jQuery change div to HTML5 contenteditable and pass to php
Current I have the following div 当前我有以下div
<div class="tag-header">
<?php echo $row->name; ?>
</div>
And I add the contenteditable to the div with .attr 我用.attr将contenteditable添加到div
$('.tag-header').attr("contenteditable", "true");
But my problem is how to pass the value to php and post to database? 但是我的问题是如何将值传递给php并发布到数据库? *NOTE: I'm not ready to use ajax just normal php submit.
*注意:我还没准备好使用普通的php提交来使用ajax。
Update html to 更新html到
<form>
<div class="tag-header">
<?php echo $row->name; ?>
</div>
<input type="hidden" id="tagval" />
</form>
Then use the focusout event to bind 然后使用focusout事件进行绑定
$(".tag-header").focusout(function() {
$("#tagval").val($(".tag-header").text());
});
Submit the form to get the value in PHP. 提交表单以获取PHP中的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.