2

Вот код, генерируем строки, в строках по 4 ячейки в последней ячейке кнопка с с вызовом модального окна, вот когда на нее нажимаешь открываются сразу все ..

    for ($l = 0; $l < $countResQuote; $l++){
           ?>
        <div class="container-fluid">
        <div class="row">
        <div class="col-xs-3"><?php print_r($goodsList[$l][5]); ?> </div>  
        <div class="col-xs-4"><?php print_r($goodsList[$l][6]); ?> </div>  
        <div class="col-xs-3"><?php print_r($goodsList[$l][7]); ?> </div> 
        <div class="col-xs-2">
               <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-modal"><?php print_r($goodsList[$l][5]); ?></button>

                 </div>
            </div>                       

         </div>     

    <div class="modal fade bs-modal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">

         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h1><?php print_r($goodsList[$l][5]); ?></h1>
        <h4 class="modal-title"><?php print_r($goodsList[$l][6]); ?></h4>
      </div>

       <div class="modal-body">
        <h2><?php print_r($goodsList[$l][7]); ?></h2>
       </div>

       <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

1 ответ 1

0

Проблема Ваша в data-target атрибуте, укажите лучше data-target="#myModal" и дайте такую id модальному окну которое хотите открыть, а у Вас сейчас data-target=".bs-modal" открывает все окна с таким классом

1
  • Спасибо!Все заработало
    – Nevega
    18 ноя 2016 в 8:21

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.