我想将动态ID添加到JQuery选择器单击事件。我看了一些其他解决方案,但它没有奏效。动态ID添加到类名称在Jquery MVC
我的代码 -
@Html.ActionLink(Model.link, "Default", "Default", null, new { @class = "btnclick"+classid, onclick = "return false;" })
<script type="text/javascript">
$(document).ready(function() {
var tmpValues = '';
tmpValues = $('this').attr('class');
$('.btnclick'+tmpValues).click(function() {
$(this).closest('form')[0].submit();
});
});
</script>
是什么让你觉得你需要添加一个动态的id_? –
_我看起来似乎没有其他解决方案_.....。 – Jai
@StephenMuecke,我有很多链接,所以当我提交链接时,我需要知道提交哪个链接 –