在我的视图中,我有2个AJAX按钮和1个开关。
这是我的ajax按钮:
@Ajax.ActionLink(" ", "BtnNext", null, new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "current",
LoadingElementId = "loading",
OnBegin = "ClearResults",
}, new { @class = "Middle-next dim btn btn-large-dim", @id = "Link1"})
@Ajax.ActionLink(" ", "BtnCallAgain", null, new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "current",
LoadingElementId = "loading",
OnBegin = "ClearResults",
}, new { @class = "Middle-callagain dim btn btn-large-dim", @id = "Link2"})
,我想使用开关,以便每当我单击开关时都可以禁用这两个按钮。谁能告诉我如何?如果那甚至可能吗?
谢谢!
您可能需要此。
@Ajax.ActionLink(" ", "BtnNext", null, new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "current",
LoadingElementId = "loading",
OnBegin = "ClearResults",
}, new { @class = "Middle-next dim btn btn-large-dim", @id = "Link1" , @style="display:none;"})
@Ajax.ActionLink(" ", "BtnCallAgain", null, new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "current",
LoadingElementId = "loading",
OnBegin = "ClearResults",
}, new { @class = "Middle-callagain dim btn btn-large-dim", @id = "Link2", @style = "display:none;" })
<input type="button" class="switch" value="switch" isValue="1"/>
<script>
$(document).on('click', '.switch', function () {
var v = $(".switch").attr("isValue");
if (v == 1) {
$(".switch").attr("isValue","0");
$(".dim").show();
}
else {
$(".switch").attr("isValue", "1");
$(".dim").hide();
}
});
</script>