Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
insert template into template

I have three templates, of which one is the main template temp_main.

<template id="temp_main">
    <div class="">          
        //rest of the form
        <div class="" id="add_or_remove_button">    
            <!-- remove or add button   -->
        </div>
    </div>
</template>

<template id="temp_add_button">
    <a href="javascript:void(0);" class="add_button" title="Add">
    <img src="../img/add-icon.png"/ alt="Add"></a>
</template>

<template id="temp_remove_button">
    <a href="javascript:void(0);" class="remove_button" title="Remove">
    <img src="../img/remove-icon.png"/>             
</template>

One of the two other ones should be inserted into the <div id="add_or_remove_button"> depending on the case.

The main template I insert into a wrapper div by:

var wrapper = $('.wrapper');
var newInputLine = $("#temp_main").html();
var add_buttonHTML = $("#temp_add_button").html();  
var remove_buttonHTML = $("#temp_remove_button").html();    
$(wrapper).append(newInputLine);

How can I add either the add or the remove button to this template? I tried:

$("#temp_main").$("#add_or_remove_button").html(add_buttonHTML);

but that´s wrong and probably a bad solution

"Uncaught TypeError: $(...).$ is not a function"

EDIT: So it´s working. Is this a good practice?

 $(wrapper).append(newInputLine);
 $(".wrapper div:last-child #add_or_remove_button").append(add_buttonHTML);
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda