Learn12
Learn12

Reputation: 216

JQuery Popup Content

I am kinda new to Javascript/JQuery programming and I have a simple question.

What I am trying to accomplish is making a 450 x 350px popup that shows on a 2 second delay. I think I have the structure down on how to make it delay and show up.

My real question is how do I add custom content to that popup box? Would I add my content in a div with an ID and then reference that ID in the JQuery code to make it pop up?

I'm just not sure where to go with this.

Let me know!

Thanks.

Upvotes: 0

Views: 60

Answers (1)

Jeremiah Heller
Jeremiah Heller

Reputation: 71

Say you have a <div id="one" class="js-one"></div>. You can change text content w/ jQuery using the id $('#one').text("Hello") or the class $('.js-one').text("Hello"); note that using the class will update all elements w/ that class. If your custom content includes HTML then you'll want to use jQuery's html method instead of text.

See: http://api.jquery.com/text/ and the docs for .html()

To show/hide the styled div, see: http://api.jquery.com/toggle/ and the docs for .show() and .hide().

Upvotes: 1

Related Questions