1
I have a Collapsible, and when it is expanded I want to add elements to it, and when it is collected I want to exclude the elements.
At the moment I’m using it as follows:
<div id="expansorTurma" data-role="collapsible">
<h4 id="expansorTurmaTitle" onclick="montarCursos()">Não sei o código da minha turma.</h4>
<h6>Escolha seu curso.</h6>
<div id="cursos"></div>
</div>
<script>
function montarCursos() {
/** **/
$("#cursos").append(<button class="ui-btn ui-corner-all">Elemento</button>')
/** **/
}
</script>
But in this case I find a big problem, because every time the button is clicked a new element is created, but I need it to be created only once, and then deleted.
When the element is closed it has the class
ui-collapsible-collapsed
, when opened this class is removed. To know when it is open or not, just see if the class mentioned above is present.– Renan Gomes
Thanks friend, it worked perfectly! I could post as reply...
– Jedaias Rodrigues