Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
¿Cómo obtener el html interno del elemento arrastrado en el botón al hacer clic?

Básicamente, he creado una plantilla html de arrastrar y soltar con javascript, lo que quiero es obtener el html interno del elemento arrastrado en el botón al hacer clic ('') automáticamente para ejecutar una función, lo que significa que lo que sea que se arrastre agregue el nombre del elemento en el botón al hacer clic ( '').

Por favor, ayúdame con esto..

 <button class="btn btn-primary pull-right" id="show_graph">SHOW</button>

código JavaScript

 $('.drag').draggable({
 appendTo: 'body',
 helper: 'clone'
 });

 $('#dropzone').droppable({
 activeClass: 'active',
 hoverClass: 'hover',
 accept: ":not(.ui-sortable-helper)", 
 drop: function (e, ui) {
 var $el = $('<div class="drop-item"><details><summary>' + ui.draggable.text() + '</summary><div><label>More Data</label><input type="text" /></div></details></div>');
 $el.append($('<button type="button" class="btn btn-default btn-xs remove"><span class="fa-solid fa-trash text-white "></span></button>').click(function () { $(this).parent().detach(); }));
 $(this).append($el);
 }
 }).sortable({
 items: '.drop-item',
 sort: function () {
 $(this).removeClass("active");
 }
 });

Aquí está el bucle for usado con la ayuda de Django y estos son los elementos que se pueden arrastrar.

 {% for item in head %}
 <div class="col-12">
 <a class="border border-light btn att1 btn-default drag text-white my-2">{{item}}</a>
 </div>
 {% endfor %}
almost 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!