Есть такой код в HTML:
<div id="slider">
<img src="images/user1.jpg" style="opacity:0.5" width="90px" height="90px">
<img src="images/user2.jpg" width="90px" height="90px">
<img src="images/user3.jpg" style="opacity:0.5" width="90px" height="90px">
</div>
Как сделать из этих изображений массив на JS/JQ?
var container = document.getElementById("slider");
console.log(Array.from(container.children));
<div id="slider">
<img src="images/user1.jpg" style="opacity:0.5" width="90px" height="90px">
<img src="images/user2.jpg" width="90px" height="90px">
<img src="images/user3.jpg" style="opacity:0.5" width="90px" height="90px">
</div>
console.log($("#slider").children().toArray())
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="slider">
<img src="images/user1.jpg" style="opacity:0.5" width="90px" height="90px">
<img src="images/user2.jpg" width="90px" height="90px">
<img src="images/user3.jpg" style="opacity:0.5" width="90px" height="90px">
</div>
var imgArray = [];
$.each($('div#slider img'), function (index, element){
imgArray.push($(element).attr('src'));
});
console.log(imgArray);
Современные инструменты для криптотрейдинга: как технологии помогают принимать решения
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости