[英]How to pass variable defined in scripts to division tag in ASP.NET MVC5 razor view?
I just want to pass value of target from script to division tag in mvc.我只想将目标值从脚本传递到 mvc 中的除法标记。 Here are the codes I have done.
这是我完成的代码。
Scripts:脚本:
@section Scripts{
<script type="text/javascript">
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("link") // activated tab
alert(target);
});
</script>
}
DIV:(outer division) DIV:(外分区)
<div class="ibox-title">
<h5><i class="fa fa-newspaper-o"></i> News & Events</h5>
<div class="ibox-tools">
<a href="@Url.Action("List","News")" style="color: #00a650;font-weight:600;">View All</a>
</div>
</div>
I just want value of target to display inside this division.我只想在这个部门内显示目标值。
Where: News in @URl.Action("List","News")
should be replaced by target's value.其中:
@URl.Action("List","News")
应替换为目标的值。
Give the div an id then use jQuery.append to add the html:给 div 一个 id 然后使用jQuery.append添加 html:
<div id="Target">
..
..
<b> target </b>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.