Reputation: 9
In my JS i"ve got an IF condition. I want to be able to make a pop-up appear in my html page. How can I make the below pop up appear in javascript?
<a href="#x" class="overlay" id="welcome_message"></a>
<div class="popup">
<h2>Welcome</h2>
<p>blah blah...</p>
<div>
<label for="name">Name</label>
<input type="text" id="name" value=""/>
</div>
</div>
Upvotes: 0
Views: 304
Reputation: 857
Use js plugin like bootstrap or modal pop up. These plugin will provide css and different functionality as well. Bootsrap
Edited
You can find demo at following link http://getbootstrap.com/javascript/#modals If still you are facing any problem please let me know.
Upvotes: 0
Reputation: 51
Try this (jQuery):
$(document).on('click', '#welcome_message:not(.active)', function(){
$(this).addClass('active');
$('.popup').show();
return false;
})
.on('click', '#welcome_message.active', function(){
$(this).removeClass('active');
$('.popup').hide();
return false;
});
Upvotes: 0
Reputation: 13839
prompt('Welcome\nblah blah...\n\nName');
would make a dialog box appear that says:
page. com says:
Welcome
blah blah...
Name ___________
\n
Creates a new line, and prompt
takes user input.
Upvotes: 1