How to format a URL.Action() call in JQuery to set a link's href attribute?
问题 I need to set the href attribute of a link to point to a specific image, which has its id from the database set as its title. However, I am having trouble with trying to format the string to include a call to get the title attribute of the image. Here is the base string: $("#favoriteLink").hover(function() { $(this).attr("href", '<%: Url.Action("FavoriteWallpaper", "Wallpaper", new{wallpaperId='+$(this).children.attr("title")+'}) %>'); }); favoriteLink is a div and the child is just one image