How to create a div element on the fly using JQuery?

I need to create a div element on the fly using JQuery as a response to a user input. Can someone please help?

Comments

  • You can use .append() function as follows.

    $("#yourElementID").append("<div>Div content goes here</div>")

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion