Показать сообщение отдельно
  #2 (permalink)  
Старый 24.09.2019, 17:46
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

Julia1991,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

  <script>
jQuery(function() {
jQuery('.preorder-snails.muller').click(function(){
var text = jQuery(this).find(".product_number_active").text();
var val = jQuery('input[name="data_num"]').val((i,v) => v.trim()=="" ? text : [v,text]).val();
jQuery('p').text((i,txt) => txt.trim() =="" ? text : +txt + +text)

  });
});
  </script>
</head>

<body>
<p></p>
<input type="text" name="data_num">
<div class="preorder-snails muller">
    <div class="product_number_active">1</div>
</div>
<div class="preorder-snails muller">
    <div class="product_number_active">2</div>
</div>
<div class="preorder-snails muller">
    <div class="product_number_active">3</div>
</div>
<div class="preorder-snails muller">
    <div class="product_number_active">4</div>
</div>
<div class="preorder-snails muller">
    <div class="product_number_active">5</div>
</div>

</body>
</html>
Ответить с цитированием