• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

126
Views
Crear $(<div/>) Jquery en Javascript puro

Estoy tratando de crear este código Jquery en javascript puro

 let container = $('body'); let cursor = $('<div/>').addClass('cursor').html('<svg/></svg>').appendTo(container);

Pero me confundí al crear un selector de javascript puro para este tipo de método de selección de jquery

 $('<div/>')

Cuando intento consolar $('<div/>') entonces la salida

 w.fn.init [div] 0: div length: 1 [[Prototype]]: Object(0)

¿Podría alguien ayudarme a crear este código jquery en código js puro?

almost 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 // Cache the container const container = document.querySelector('body'); // Create a new element const cursor = document.createElement('div'); // Add the className, and innerHTML cursor.className = 'cursor'; cursor.innerHTML = '<svg></svg>'; // Append it to the container container.appendChild(cursor);
 .cursor { border: 1px solid black; height: 100px; width: 100px; }

Documentación adicional

  • querySelector

  • createElement

  • className

  • innerHTML

  • appendChild

almost 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error