const sorted = (data, keys) => Array
.from(data, n => [ n ].concat(keys(n)))
.sort((a, b) => {
let diff = 0;
for (let i = 0; ++i < a.length && !(diff = ((a[i] < b[i]) ? -1 : +(a[i] > b[i])));) ;
return diff;
})
.map(n => n[0]);
const sortChildren = (el, keys) =>
el.append(...sorted(el.children, keys));
const ul = document.querySelector('ul');
ul.addEventListener('change', e => sortChildren(
e.currentTarget,
el => [
-el.querySelector('input').checked,
el.innerText.trim().toLowerCase(),
]
));
ul.dispatchEvent(new Event('change'));
<div class="content">
<div class="tech">Бренд</div>
<div class="tech">Guardo</div>
<div class="tech">Тип индикации</div>
<div class="tech">Стрелочная</div>
<div class="tech">Тип механизма</div>
<div class="tech">Кварцевый</div>
</div>
$('#form').validate({
rules: {
name: {
required: true
}
},
messages: {
name: {
required: "Поле обязательно для заполнения"
}
},
submitHandler: function(form) {
$(form).ajaxSubmit({
type:"POST",
data: $(form).serialize(),
url:"mail.php",
success: function() {
});
},
error: function() {
}
});
}
});
<?php
$to = 'твой ящик ';
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=utf-8";
$headers[] = "From: $from";
$headers[] = "X-Mailer: PHP/".phpversion();
$subject = "Тема письма";
$fields = array();
$fields{"name"} = "ФИО";
// Добавляем нужные поля формы
$body = "Данные формы:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%s: %s\n",$b,$_REQUEST[$a]); }
$send = mail($to, $subject, $body, implode("\r\n", $headers));
?>