+ 1
How can I send a inner HTML JavaScript dom via input type hidden to a PHP file?
?
2 Antworten
+ 2
Not a functionnal script, but for the principles:
<div id="source">text content</div>
<form submit="phpfile" method="post">
<input type="hidden" id="myhiddenfield">
<input type="submit" id="validbt">
</form>
<script>
var hid=document.getElementById('myhiddenfield');
var div=document.getElementById('source');
hid.value=div.innerHTML;
</script>
As is, you need the user submit the form, but you can trigger an event click by yourself:
document.getElementById('validbt').click();
- 1
Use script tag of html and embed all code at once