user4278149
user4278149

Reputation: 13

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

Upvotes: 0

Views: 189

Answers (2)

Idan Azulay
Idan Azulay

Reputation: 16

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>

Upvotes: 0

Sharma Vikram
Sharma Vikram

Reputation: 2470

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

Upvotes: 1

Related Questions