1
I need that when a person clicks on a given button, an element is created on the page.
I’ll explain what I want to do with it.
I’m creating a button, and when it’s clicked, a
modal-box
(a kind of window that goes down on the screen), and within this modal, I want to put some social widgets such as facebook, twitter, Google+, etc... But I need these widgets to be loaded only when the person clicks on this "share button".
What I need is this.
A link that when clicked, the modal content is loaded.
My code
Knob:
<a href="#compartilhar" data-toggle="modal">Compartilhar</a>
Modal:
<div id="compartilhar" class="modal" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<span id="loginModalLabel">Compartilhe!</span>
</div>
<div class="modal-body">
<!-- AQUI IRÁ FICAR O CONTEÚDO CARREGADO /-->
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancelar</button>
</div>
</div>
Thanks in advance :D
"need these widgets to be loaded only when the person clicks on that button" <- why? that modal is not hidden? or is+a using the
modal
for different contents?– Sergio
Exactly, I use it for other things as well. I want it to be loaded only when click because loaded along with the page weighs in the load. Thanks for asking.
– Alexandre Lopes