简体   繁体   中英

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

$('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

use this html code for your a tag

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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