<div id="befor-box">
<form id="newsletter-form" name="newsletter-form" action="/sub/" method="post">{% csrf_token %}
<input name="email" type="text" value="Enter your Email here" class="text"/>
<input class="submit" onclick="showDialog();" value="Subscribe!" />
</form>
</div>
How to get EMAIL value from:
<input name="email" type="text" value="Enter your Email here" class="text"/>
to:
<input name="email" type="text" value="" class="text"/>
from here:
<div id="dialog-modal" style="display:none;">
<form name="newsletter-form" action="/sub/" method="post">
<input name="email" type="text" value="" class="text"/>
<input name="fname" type="text" value="First name" class="text"/>
<input name="lname" type="text" value="Last name" class="text"/>
<input type="submit" class="submit" value="Subscribe!" />
</form>
</div>
<script type="text/javascript">
function showDialog()
{
$( "#dialog-modal" ).dialog({
});
}
</script>
If user click the hyperlink <a>See Milk</a> from the primary form, then will showing a JQuery Modal Dialog. Then if the option list are selected from the Modal Dialog & click Submit, it should closing the Modal Dialog & showing the value on the input type at primary form.
Answer: Use the jQuery val() Method You can simply use the jQuery val() method to get the value in an input text box.
The jQuery UI dialog method is used to create a basic dialog window which is positioned into the viewport and protected from page content. It has a title bar and a content area, and can be moved, resized and closed with the 'x' icon by default.
use open event of dialog which is called whn dialog opens... so replace the value there..
$( "#dialog-modal" ).dialog({
open: function( event, ui ) {
var boxInput=$("#befor-box").find('input[name="email"]').val(); //get the value..
$("#dialog-modal").find('input[name="email"]').val(boxInput); //set the valu
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With