How to remake this code in ui jquery widget?

There is such jquery code. When you select an item using the checkbox, the item is cloned and added to another block. Tell me how to rewrite it in jquery ui widget since magento uses them to inject js code. Even if you have suggestions on how to improve the code, then I would love to read your ideas :)

I will also be glad of any help from such examples, thanks

example on codepen: https://codepen.io/annbin/pen/VwYRerL

  • yes so you need to ad only that js code or add its library js files too? – sarvesh Dineshkumar Patel Jan 25 at 12:14
  • please check here I added jquery code. magento.stackexchange.com/questions/298841/… so you get idea okay. – sarvesh Dineshkumar Patel Jan 25 at 12:15
  • @sarveshDineshkumarPatel I don't quite understand you. I only need to convert the logic of this code to more similar to jquery widgets – ann karsksya Jan 25 at 12:22
  • Yes that is why I given complete code. now you need to code it. please try it. or if you can not do I can do for you. – sarvesh Dineshkumar Patel Jan 25 at 12:24
  • @sarveshDineshkumarPatel I tried, I just do not have enough knowledge. As it turned out, I find elements incorrectly through the code, I need something different, for example, through events. I don’t quite understand how the jquery widgets methods that start with underscore work. That's why I asked for help – ann karsksya Jan 25 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.