0
Code to call the Divs:
<input style="float: right;" class="botao1" onclick="addRisco()" value="Adicionar Risco"/>
</td>
</tr>
</table>
</fieldset>
<div id="riscos">
</div>
<fieldset class="grupo">
<table width="100%" class="campo" cellspacing="10">
<tr>
<td>
<input style="float: right;" class="botao1" onclick="addRisco1()" value="Acção"/>
</td>
</tr>
</table>
<div id="riscos1">
</div>
With this function every time I click the button opens a div:
function addRisco(){
$("#riscos").append("<div>"+$("#riscoform").html()+"</div>");
}
function addRisco1(){
$("#riscos1").append("<div>"+$("#riscoform1").html()+"</div>");
}
But I intend that the function only allows to open once the div.
How you call the addRisco() and addRisco1() functions. Enter their call code.
– Netinho Santos
You can put an id on
div
and check if it already exists before doing theappend
,a simple solution, what do you think?– Ricardo Pontual