如何通过Jquery获取锚文本 [英] how to get anchor text through Jquery
本文介绍了如何通过Jquery获取锚文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<ul id="FirstList @nIndex" style="display: block;">
<li>
<a class="tree clientName" href="java<!-- no -->script:toggle('SecondList @nIndex)"><img src="images/icon-rr.png" />@clientID</a>
<ul id="SecondList @nIndex">
<li>
<a class="tree" href="java<!-- no -->script:toggle('ThirdList @nIndex')"><img class="paddingr" src="images/icon-rating.png" />Rating</a>
@* Loop for binding the Rate Code *@
@for (int j = nIndex; j < Model.Clients.ClientTree.Count; j++, nIndex++)
{
if (clientID == Model.Clients.ClientTree[j].ClientID)
{
<ul id="ThirdList @nIndex" style="display:none;">
<li>
<a class="tree " href="java<!-- no -->script:toggle('FourthList @nIndex')"><img class="paddingee" src="images/icon-trolly.png" />@Model.Clients.ClientTree[nIndex].RateCode <span>(</span>@description <span>)</span></a>
<ul id="FourthList @nIndex" style="display:none;">
<li>
<a class="tree " href="#"><img class="paddinltl" src="images/icon-carriers.png" />LTL Carriers</a>
<ul id="FivethList @nIndex" style="display:none;">
@* Loop for binding the LTL Carriers *@
@for (int k = 0; k < Model.Clients.CarrierLTLTree.Count; k++)
{
var currentLTLCarier = Model.Clients.CarrierLTLTree[k];
if (clientID == currentLTLCarier.ClientID)
{
var dateFormat = new System.Globalization.DateTimeFormatInfo();
var effectiveDate = currentLTLCarier.EffectiveDate.ToString("MM/dd/yyyy");
<li>
<a class="tree ltlCarrier" href="#"><img class="paddinltlCarrier" src="images/icon-rr.png" />@currentLTLCarier.Scac <span>(</span>@effectiveDate <span>)</span></a>
</li>
}
else
{
}
}
</ul>
</li>
<li>
<a class="tree" href="#"><img class="paddinltl" src="images/icon-carriers.png" />TL Carriers</a>
<ul id="SixthList @nIndex" style="display:none;">
@* Loop for binding the TL Carriers *@
@for (int k = 0; k < Model.Clients.CarrierTLTree.Count; k++)
{
var currentTLCarier = Model.Clients.CarrierTLTree[k];
if (clientID == currentTLCarier.ClientID)
{
var effectiveDate = currentTLCarier.EffectiveDate.ToString("MM/dd/yyyy");
<li>
<a class="tree" href="#"><img class="paddinltlCarrier" src="images/icon-rr.png" />@currentTLCarier.Scac <span>(</span>@effectiveDate <span>)</span></a>
</li>
}
else
{
}
}
</ul>
</li>
</ul>
</li>
</ul>
}
else
{
nIndex--;
break;
}
}
</li>
</ul>
</li>
</ul>
我的查询是如何获取锚文本的jquery
My query is how get anchor text in though jquery
推荐答案
嗯,你的问题不清楚,但似乎你正在寻找一种遍历treeview的方法ol获取所选树节点的面包屑样式表示。
尝试这个小提琴: http://jsfiddle.net/Wc46w/ [ ^ ]
这是递归收集所有锚文本的jQuery算法:
Well, your question is unclear, but it seems that you are looking for a way to traverse a treeview control to get a breadcrumb-style representation of a selected tree node.
Try this fiddle: http://jsfiddle.net/Wc46w/[^]
Here's the jQuery algorithm that recursively collects all the anchor text:
(function(){
var breadCrumb = getAnchorText(
(function() { var breadCrumb = getAnchorText(
(' .selected'));
这篇关于如何通过Jquery获取锚文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文