开发者

Replace all divs with value

I have the following code:

$('#select_albums').load(document开发者_如何转开发.location.href + "&action=get_albums");

But this is only replacing only the first found div with the id #select_albums from DOM. How do I replace all divs with an id?


Every item in the DOM has a unique id. If you want to act on many divs at the same time use a class $(".myclass") or a tag $("div") selector.


Yes because by definition an element ID can only appear once on a page. If you have more elements use a class instead.

$('.select_albums').load(document.location.href + "&action=get_albums");

With

<div class="select_albums"></div>
<div class="select_albums"></div>


id's must be unique, try using a class instead such as $(".albums").load...


ids must be unique

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜