2

Vs'12 Asp.net C# MVC4,互联网应用模板

我正在尝试<script>为我的下拉列表编写一个来更改操作链接的信息。

到目前为止我有什么

 function select_prospect() {
    //Handle the select event

    $('#YourActionLinkName')val() = $("#Prospects").val();

    var val = $("#Clients").val();
    var href = "/Prospect/Index/" + val;
    this.href = ""; //clears out old href for reuse
    this.href = href; //changes href value to currently slected dropdown value
}

我正在尝试按 ID / 名称获取我的 Actionlink,然后更改其值并使用下拉列表中的值添加相应的 href。我究竟做错了什么?

编辑:

根据 Ufuks 的回答,我已尝试过此代码

$('#YourActionLinkName').val(
  $("#Prospects").val(),
  this.href = "/Prospect/Create/" + $("#Prospects").val()
);

在 < script > 的页面底部,仍然没有正确更新我的 actionlink。想法?

4

1 回答 1

5

这不是您使用该val功能的方式

$('#YourActionLinkName').val() = $("#Prospects").val();

它应该是这样的:

$('#YourActionLinkName').val($("#Prospects").val());
于 2013-09-10T14:45:29.133 回答