简体   繁体   English

如何更改锚标签的属性值

[英]How to change attribute value of anchor tag

Hi I a have an anchor tag with default object values 嗨,我有一个带有默认对象值的锚标记

<a type="hidden"id="submitExport" href="@Url.Action("ExportAllToExcel", new { strvoicerecordfetchquery = "", nSelectAllten = "", bSelectAll = "" })" ></a>

I want to change values of 我想更改的值
strvoicerecordfetchquery ,nSelectAllten and bSelectAll accordingly from script 从脚本中相应地获取strvoicerecordfetchquery,nSelectAllten和bSelectAll

$('a').prop("href", 'Url.Action("ExportAllToExcel", new { newval = "", dd = "", bSenew valdd= "" })');

you got a problem with quotes inside quotes in the href attribute and because of that the jquery prop method returns not the whole value of the href 您遇到了href属性中的引号内的引号问题,因为jquery prop方法未返回href的整个值

use this html code for your a tag 使用此html代码作为标签

<a type="hidden"id="submitExport" href="@Url.Action('ExportAllToExcel', new { strvoicerecordfetchquery = '', nSelectAllten = '', bSelectAll = '' })" ></a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM