下面是选择特定对象并在sharepoint 2010中员工目录项列表中的所有对象之前插入的代码。
如果职位名称在managerTitles
列表中,如果他们不是第一个,请将此人列为第一个
if($.inArray(jobTitle3, managerTitles) >= 0) {
// If they're not first in the list, move them there"
if(personIndex > 0) {
// Move the manager to first
$(this).insertBefore($('.psrch-FullResult:first'));
}
// Insert a block div to create a line break after the manager
$("<div style='display:block;clear:both;'></div>").insertAfter($('.psrch-FullResult:first'));
//removed this line due to need for multiple heads of a dept -- return false;//Leave the .each iterator
}
代码
$(this).insertBefore($('.psrch-FullResult:first'));
没有做任何事情,所以代码
$("<div style='display:block;clear:both;'></div>").insertAfter($('.psrch-FullResult:first'));
但是当我尝试写一些东西时
$("<p>testing</p>").insertBefore($('.psrch-FullResult:first'));
它有效
请提出一些解决方案。