我正在尝试查找所有<h2>
标签将其拆分并将它们与<a href=''></a>
加在一起。我很亲密,但卡住了。jQuery分裂为HTML标签,即在每个h2标签的实例处分割?
<script type="application/javascript">
$(document).ready(function() {
// finds all h2's within wrapper div grabs the text splits at ? and applies a links around each one
var al = $('#wrapper').find('h2').text().split("?").join("?</a><br /> <a href='#'>");
// Add all the split h2's from the variable above al to a div called .text
$('.text').html('<ul>' + al + '</ul>');
});
</script>
这是警告我的输出(人):
Appropriate Media – Why radio?</a><br /> <a href='#'>Can someone come and speak at my church?</a><br /> <a href='#'>Do you distribute radios?</a><br /> <a href='#'>Do you partner with other organisations?</a><br /> <a href='#'>How is Feba funded?</a><br /> <a href='#'>What are your programmes about?</a><br /> <a href='#'>What denomination does Feba belong to?</a><br /> <a href='#'>What happened to the Chrysolite?</a><br /> <a href='#'>What is airtime?</a><br /> <a href='#'>What is Feba's Statement of Faith?</a><br /> <a href='#'>Where are the programmes made?</a><br /> <a href='#'>Where can I find out about the languages & countries you broadcast in?</a><br /> <a href='#'>Where does the name Feba come from?</a><br /> <a href='#'>Who do you broadcast to?</a><br /> <a href='#'>Why do you broadcast on short wave?</a><br /> <a href='#'>
好了,所以此刻我能,因为每个问题有?
结束他们在?
分裂,但我的问题是这忽略了第一个问题。
所以我的解决方案是将它们拆分为<h2>
标签这是可能的还是有更好的选择,我已经尝试了这么多?
你** **应该与编辑新的细节你的问题,而不是回答你自己的问题,如果这不是一个*答案* – 2010-11-18 12:03:16
,啊对确定生病做下一次 – iSimpleDesign 2010-11-18 12:19:19
您可以现在就做,通过删除这个答案,并将信息添加回您的问题 – 2010-11-18 13:10:21