Сообщение от djonA
|
По единично работает а как предварительно объединить их не получается?
|
Оно?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<script src='http://code.jquery.com/jquery-latest.js'></script>
<!--
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
</style>
<script type='text/javascript'>
window.addEventListener('DOMContentLoaded', function() {
window.addEventListener('mousedown', function create(event) {
var nodes = document.querySelectorAll('.alliki'),
selects = document.querySelectorAll('.select');
var cls = event.target.classList;
if(cls && cls.contains("select")){
[].forEach.call( selects, function(select) {
[].forEach.call( nodes, function(span) {
var val = span.innerHTML;
val += span.nextSibling.innerHTML;
var option = new Option(val, val);
select.appendChild(option)
})
})
};
window.removeEventListener('mousedown',create)
});
});
</script>
</head>
<body>
<span class="alliki">1</span><span class="dop">1</span>
<span class="alliki">2</span><span class="dop">2</span>
<span class="alliki">3</span><span class="dop">3</span>
<span class="alliki">4</span><span class="dop">4</span>
<select class="select" >
</select>
<select class="select" >
</select>
</body>
</html>