Avatar ·

How to create a div element using jQuery and add it to the page?

Hello everyone! I just started learning jQuery and I can't figure out how to create new elements on the page. I keep getting confused with the syntax. I need to dynamically add blocks with information to the site. I know that in pure JavaScript I can create a div using `document.createElement('div')`, and then add it using `appendChild`. But how can I do this more simply with jQuery? I tried writing something like `$('
')`, but I don't understand how to then insert this div into the right place on the page. For example, I have a container: ```html

Current text

``` And I need to add a new block with class `new-block` inside it, which will contain a heading and a paragraph. I tried to do this: ```javascript var newDiv = $('
'); new