Current I have the following div
<div class="tag-header">
<?php echo $row->name; ?>
</div>
And I add the contenteditable to the div with .attr
$('.tag-header').attr("contenteditable", "true");
But my problem is how to pass the value to php and post to database? *NOTE: I'm not ready to use ajax just normal php submit.
Added a demo here
Update html to
<form>
<div class="tag-header">
<?php echo $row->name; ?>
</div>
<input type="hidden" id="tagval" />
</form>
Then use the focusout event to bind
$(".tag-header").focusout(function() {
$("#tagval").val($(".tag-header").text());
});
Submit the form to get the value in PHP.
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.