Jump to content

Hidden Input Field


mwl707

Recommended Posts

<script language="javascript">

function doInsert(){

	var container = document.getElementById("the_hidden_container");
	container.innerHTML = "<input type=\"hidden\" name=\"salary\" id=\"salary\" value=\"33000\" />";
}

</script>

<form>
Sample Text
<div id="the_hidden_container"></div>
Sample Text
<input type="button" value="Insert Hidden Field" onclick="doInsert()" />
</form>

 

If you test it in firefox, click the button, then select both sample text and click view source, you will see the hidden input field has been inserted into the div tag. Hope that helps.

Link to comment
https://forums.phpfreaks.com/topic/174032-hidden-input-field/#findComment-919186
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.