【发布时间】:2015-01-07 01:53:49
【问题描述】:
我希望添加一个警报,该警报会在选择 id deSelectAll 的按钮时弹出,可以选择确认、执行操作,或者取消并返回页面而不做任何更改。目前我有以下代码。
$("#deSelectAll").click ->
alert "Are you sure you want to remove all"
root.table.$("tr").removeClass "selected"
但所有显示以下结果:
我还希望能够确认或取消请求。如何实现?
更新:我添加了确认按钮,但它根本不调用警报
# Deselecting all
$("#deSelectAll").click ->
confirmRemovalFunct()
confirmRemovalFunct = ->
confirm("Are you sure you want to remove all locations from campaign")
#alert "Are you sure you want to remove all locations from campaign"
root.table.$("tr").removeClass "selected"
allLocations = root.table.rows().data() # Then defaults to shows all the locations that are availale
$('#multi_markers').map ->
handler = Gmaps.build("Google")
handler.buildMap
internal:
id: "multi_markers"
, ->
for aLocation in allLocations
markers = handler.addMarkers([
{
lat: aLocation[9]
lng: aLocation[10]
}
])
handler.bounds.extendWith markers
handler.fitMapToBounds()
return
【问题讨论】:
标签: javascript jquery dialog alert