我一直试图从
弹出一个模态Code Snap :: 模态表格
<div id="loginmodal" style="display:none;">
<h1>User Login</h1>
<form id="loginform" name="loginform" method="post" action="index.html">
<label for="username">Username:</label>
<input type="text" name="username" id="username" class="txtfield" tabindex="1">
<label for="password">Password:</label>
<input type="password" name="password" id="password" class="txtfield" tabindex="2">
<div class="center"><input type="submit" name="loginbtn" id="loginbtn" class="flatbtn-blu hidemodal" value="Log In" tabindex="3"></div>
</form>
</div>
下拉菜单::
<select class="selectpicker form-control" id="count">
<option value="0" selected="selected">Select Variable</option>
<option value="a">a </option>
<option value="b">b </option>
<option value="c">c </option>
</select>
Java Script ::
$('#count).change(function() {
document.getElementById('loginmodal').click();
$('#modaltrigger').leanModal({ top: 110, overlay: 0.45, closeButton: ".hidemodal" });
});
但它不适合我。可以帮我一个人吗?
答案 0 :(得分:1)
基于这个答案
jQuery get value of select onChange
和
上的这个How to open a Bootstrap modal window using jQuery?
它应该是这样的:
$('#count').change(function()
{
if (this.value == 'c')
{
$('#loginmodal').modal('show');
}
});