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

109
Views
Equivalent of document.createElement in jquery

I am working with web components. What is the equivalent of the following code in jquery?

const horizontalMasonry = document.createElement('test-horizontal-masonry');
horizontalMasonry.items = [
    {
        id: `0`,
        url: "https://homepages.cae.wisc.edu/~ece533/images/watch.png",
        isPremium: false,
        alt: 'Thumbnail'
    },
    {
        id: `1`,
        url: "https://homepages.cae.wisc.edu/~ece533/images/baboon.png",
        isPremium: true,
        alt: 'Thumbnail'
    },
    {
        id: `2`,
        url: "https://homepages.cae.wisc.edu/~ece533/images/cat.png",
        isPremium: true,
        alt: 'Thumbnail'
    }
];

horizontalMasonry.addEventListener('THUMBNAIL_CLICK_EVENT', () => {
    // e.detail.item
});

document.body.appendChild(horizontalMasonry);

I tried

        $masonry = $('<theo-horizontal-masonry rows="1"></theo-horizontal-masonry>');
        $masonry.items = items;
        $masonry.width = 256;
        $masonry.height = 100;
        $carousel.append($masonry);

but the element is not retaining the properties items, width, height.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are setting things to the jQuery object, not the element itself. You should be using attr() or prop() to change the DOM element.

$masonry.attr('items', items);
// or
$masonry.prop('items', items);
about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!