1

デフォルトで存在するボタンではなく、DIV から (動的に作成された) すべてのコンテンツを削除する必要があります。これはHTMLです:

<div id="{{ entity.getLabel|lower ~ "_choice_" ~ entity.getId }}" style="display: none">
    <button type="button" class="add-size">Adicionar {{ entity.getLabel|lower }}</button>
</div>

そして、私は次のようにしています:

$("#" + theName + '_choice_' + theID).empty();
$("#" + theName + '_choice_' + theID).hide();

もちろん、vars は適切な値を取ります。.empty()すべて削除するのは難しいので、ボタンを離れる必要があります。どうすればいいですか?

PS: どちらの場合も、HTML と jQuery のコードは vars と Twig タグを忘れて$.empty()います。

4

1 に答える 1

5
$("#" + theName + '_choice_' + theID).find(':not(button)').remove();
于 2013-09-11T17:49:24.210 に答える