我想用php代碼調用modal('show')
事件。我怎樣才能做到這一點?我嘗試了以下內容:用php調用bootstrap模態顯示事件
if(isset($_POST['Edit'])){
echo "<script> $('#Modal').modal('show') </script>";}
我運行此代碼,但echo "<script> $('#Modal').modal('show') </script>";
不起作用。點擊圖像輸入時如何顯示模式?我不想打電話與圖像onlick。
輸入:
<input type="image" src="image.png" name="Edit" value="Edit" alt="Edit" />
模態:
<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>
請確保你的腳本echo'ing你的腳本後jquery和bootstrap.js已被加載 – Dale
還要確保有一個窗體周圍的圖像輸入與其方法設置爲 – Dale
和最後一個評論,一些瀏覽器(IE瀏覽器, FireFox)沒有收到圖像輸入的名稱(他們收到它被點擊的x,y座標[見本](http://stackoverflow.com/a/13539986/1207346)),可能想嘗試在你的isset中使用'$ _POST ['Edit_x']' – Dale