Copy HTML elements into a form

0

I want to copy the div clicked, into the form that already contains the select .

For example this:

        var opt = document;

        function processar(el) {
            opt.getElementById('minhaLista').innerHTML = el;
        }
    <form name="form" id="minhaLista">
        <select>
          <option value="">A</option>
          <option value="">B</option>
          <option value="">C</option>
        </select>
    </form>

    <hr size="1">

    <div id="vitrine">
        <div id="produto1">
            <a href="javascript:void(0)" onclick="processar(produto1)">
<img src="https://sites.google.com/site/mplayerplugin/repositorio/procurando_dory.jpg"width="300" />
</a>
            <div>
                A
                <p>Exemplo 1</p>
                <span>1</span>
            </div>
        </div>

        <hr size="1">

        <div id="produto2">
            <a href="javascript:void(0)" onclick="processar(produto2)">
<img src="https://sites.google.com/site/mplayerplugin/repositorio/big_buck_bunny.jpg"width="300" />
</a>
            <div>
                B
                <p>Exemplo 2</p>
                <span>2</span>
            </div>
        </div>
        <hr size="1">

            <div id="produto3">
                <a href="javascript:void(0)" onclick="processar(produto3)">
                <img src="https://sites.google.com/site/mplayerplugin/repositorio/animais_cantando.jpg"width="300" />
</a>
                <div>
                    C
                    <p>Exemplo 3</p>
                    <span>3</span>
                </div>
            </div>
    </div>

The main focus is the image element [ img ], paragraph [ p ], and text [ span ].

The select must remain within form , without removal by script .

Perhaps the correct term is to make a replica from div to form .

As simple as that may seem, unfortunately I could not.

    
asked by anonymous 01.06.2018 / 21:41

0 answers