I've the elements as follows,如何追加字符串<a href=" with jQuery or Javascript?
<div id="pager">
<a href="/somepath/1">First</a>
<a href="/somepath/1">Previous</a>
<a class="" href="/somepath/1">1</a>
<a class="Current" href="/somepath/2">2</a>
<a class="" href="/somepath/3">3</a>
<a href="/somepath/3">Next</a>
<a href="/somepath/20">Last</a>
</div>
and I want it to be changed as follows within browser.
<div id="pager">
<a href="/somepath/1?a=text">First</a>
<a href="/somepath/1?a=text">Previous</a>
<a class="" href="/somepath/1?a=text">1</a>
<a class="Current" href="/somepath/2?a=text">2</a>
<a class="" href="/somepath/3?a=text">3</a>
<a href="/somepath/3?a=text">Next</a>
<a href="/somepath/20?a=text">Last</a>
</div>
So that I can use the "a" data values to next page. Can any one give me the code, which does the appends inside
div id="pager"
-><a>
->href="
and i wants to remove the added text with another onChange event.
Thanks in advance
-1爲「兒童」(不,不是真的) – Blazemonger
@Blazemonger你是什麼意思? var名稱是錯誤的? –
@Bondye'.each'函數有什麼問題? *「+ 1最後一個沒有.each()函數...人們不明白.each()..」*。您發佈此評論的答案,您認爲在代碼背後發生了什麼?另外,'.each()'更快:http://jsperf.com/each-vs-function –