我有一个SharePoint生成的页面。从那里我试图从下面的例子中提取第二个<td>
值。如何使用jQuery遍历代码并获取该值?
<span id="part1">
<table cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td align="right" width="100%" nowrap="nowrap">
<tbody>
<tr>
<td nowrap="true" valign="top" width="113px" class="ms-formlabel"><h3 class="ms-standardheader"><a name="SPBookmark_Title"></a>Title</h3></td>
<td valign="top" class="ms-formbody" width="350px" id="SPFieldText">
<!-- FieldName="Title"
FieldInternalName="Title"
FieldType="SPFieldText"
-->
Test Project
</td>
</tr>
</tbody>
</table>
</span>
我试过了:
$('#part1 table tbody tr:nth-child(1)').each(function() {
titleTxt = $(this).find(".ms-formbody").html();
alert(titleTxt);
});
但我得到了垃圾值。
我像这样使用$('#part1 > table:first tr:first td:nth-child(2)').html();
并获得结果
<!-- FieldName="Title"
FieldInternalName="Title"
FieldType="SPFieldText"
-->
Test Project
如何评论igrone
答案 0 :(得分:1)
尝试
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.UntypedActor;
public class Messenger extends UntypedActor {
private static ActorRef hero;
public Messenger() {
ActorSelection master = context().actorSelection("akka.tcp://testHero@127.0.0.1:2552/user/master");
System.out.println(master);
hero = master.anchor();
}
@Override
public void onReceive(Object arg0) throws Exception {
System.out.println("msg = " + arg0);
}
public static void main(String[] args) {
ActorSystem system = ActorSystem.create("test");
ActorRef actor = system.actorOf(Props.create(Messenger.class), "msgnr");
System.out.println(actor.getClass() + " >> " + actor);
System.out.println(hero);
actor.tell("Hi", hero);
}
}
或者
$('#part1 table tr:first td:nth-child(2)').html()