I need a dialog window to popup with a form and pass a value to this form. I have attempted several approaches to this problem but I have been unable to do so. I have searched all over and nothing seems to work.
This is my latest attempt:
var message="variable";
.click(function() {
$( "#dialog-form" ).dialog( "open" );
$('<input>').attr({
type: 'text',
id: 'hidden-input",
value: message,
name: 'bar'
}).appendTo("#dialog-form");
If i put the append inside the dialog the popup stops working (i think i dont know how to do this properly)
I think you're looking for something like this:
<script>
$(function(){
var message = "variable";
$("#showDialog").click(function() {
$("#hidden-input").val(message);
$("#dialogForm").dialog("open");
});
});
</script>
<button id="showDialog">Show Dialog</button>
<div id="dialogForm">
<input type="text" id="hidden-input" name="bar"/>
</div>