简体   繁体   中英

Appending parent elements attribute to the URL of anchor tag href

<asp:Repeater runat="server" ID="rptStockListings">
  <ItemTemplate> 
    <li rank=<%#GetRank(DataBinder.Eval(Container.DataItem,"r"))
       ...............
       <a href="<%# DataBinder.Eval(Container.DataItem,"Url")

I have URL already but i want to append the rank attribute of li element which is ancestor of this anchor with href="Url".

How can I do that?

Basically i want to pass information to the next opened page by anchor tag in the url itself.

Hope this helps

<a onclick='openThis(<%# DataBinder.Eval(Container.DataItem,"Url"), this)'>Click here</a>

In javascript:

function openThis(url, obj) {
    var appendThis = $(this).closest("li").attr("rank");
    window.open(url+appendThis + , "_self")
}

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