[英]How to get the div value javascript php html
Myhtml: MYHTML:
<form id="w" action="modify_review.php?act=transmitNext" method="POST">
<input id="title" name="title" value="" />
<div class="selected_staff" id="selected_staff" name="editor"></div>
</form>
modify_review.php: modify_review.php:
<?php
echo $_POST["title"];//works fine
echo $_POST["editor"];//failed
?>
How can i get the div value in myphp? 我如何在myphp中获得div值? who can help me ?
谁能帮我 ?
You have two ways to achieve this. 您有两种方法可以实现此目的。
textarea
. textarea
。 Use JavaScript to get the value with existing code structure (just one hidden input field need to be added). 使用JavaScript获取具有现有代码结构的值(只需添加一个隐藏的输入字段)。
hidden
name: editor Id=selectedStuff
hidden
名称:编辑器Id=selectedStuff
bind getSelectedStuff
method on onchange
on div id=selected_stuff
在div
id=selected_stuff
onchange
上绑定getSelectedStuff
方法
function getSelectedStuff(userInput){ // get user input var inputValue = userInput.value; //set value to hidden input document.getElementById("selectedStuff").value = inputValue; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.