A
A
Avguston2017-09-16 22:32:09
1C-Bitrix
Avguston, 2017-09-16 22:32:09

How to pass value to modal window?

Hello. I have a catalog.section component and a button to cart. I need that when this button is clicked, a modal window opens and parameters are passed there - for a start, at least the name of the product.
How can I do it?
I understand that the onclick event should be hung on this button

<div id="nameofproduct">Здесь имя товара</div>
<button onclick="openwindow('<?=$arItem["NAME"]?>')">В корзину</button>
<script>
function(openwindow){
//что тут писать
}
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Skleinov, 2017-09-17
@lexskal

$( document ).ready(function() {

        $('button.class').click(function(){
            $(div.class).text($('#nameofproduct'));
        });

    });

something like that... use libraries, you don't have to use on-click... if you had brought the layout of the modal window, it could have been more precise...
Actually, such features are made in Ajax. Perhaps you have another task,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question