I want to call modal('show')
event with php code. How can I do this? I tried the following:
if(isset($_POST['Edit'])){
echo "<script> $('#Modal').modal('show') </script>";}
I run this code, but echo "<script> $('#Modal').modal('show') </script>";
doesnt work. How can I show modal when image input is clicked? I don't want to call with image onlick.
Input:
<input type="image" src="image.png" name="Edit" value="Edit" alt="Edit" />
Modal:
<div class="modal hide fade" id="Modal" >
<form method="post">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" style="margin-top:-10px">×</button>
</div>
<div class="modal-body">
<textarea id="text" name="text">Test</textarea>
</div>
<div class="modal-footer">
</div>
</form>
</div>
Best Answer
Set the document.ready function as shown below:
On a side note, this work around is also great if you have a modal login form and need to alert the user on submit (or $_POST) for any submission errors in a seperate modal.