我需要在Bootstrap按钮组中传递一些复选框,并在 let urlData = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: &error)
if error != nil || urlData!.length == 0
{
println("Error happend timeout======\(error?.code)!")
continue
}
else //else1
{if let httpResponse = response as? NSHTTPURLResponse
{
println("Status Code for successful---\(httpResponse.statusCode)")
// For example 502 is for Bad Gateway
if (httpResponse.statusCode == 502)
{
// Check the response code from your server and break
break
}
else
{
//Your code
}
}
}
点击时仅隐藏关联的.dropdown-menu
。
正如您在#apply
点击list-group-item
时所看到的那样隐藏了.dropdown-menu
,除非您完全点击复选框
<div class="container">
<!-- Single button -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Action <span class="caret"></span>
</button>
<div class="dropdown-menu list-group">
<button type="button" class="list-group-item"><input type="checkbox" name="type" value="item1"> Item 1 </button>
<button type="button" class="list-group-item"><input type="checkbox" name="type" value="item2"> Item 2</button>
<button type="button" class="list-group-item"><input type="checkbox" name="type" value="item3"> Item 3</button>
<button type="button" class="list-group-item"><input type="checkbox" name="type" value="item4"> Item 4</button>
<button type="button" class="list-group-item"><input class="btn btn-default btn-block" type="submit" value="Apply Changes" id="apply"></button>
</div>
</div>
</div>
是否可以告诉我如何阻止此操作并启用#apply
按钮以正确关闭dropdown-menu
?
由于
答案 0 :(得分:0)
这是:
<强> Bootply 强>
<强> JS 强>:
$("#apply").on("click", function(){
$("input:checked").parent().hide().slideUp();
});
$('.list-group-item').on('click', function(e){
e.stopPropagation();
});