我正在嘗試查找所有<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