adding style properties to an alert box - javascript

Here's a quick background on what I'm trying to do. I have a contact form on my website, and when the user clicks on 'Submit', I want it to do this:
User clicks submit
Confirmation box opens, asking user to agree or disagree to the
disclaimer
if agrees = submit form
if disagrees = close confirmation box
Here is what I want to know. I don't necessarily want to style the actual alert box, since I know that is not possible, what I want to do is style the text inside the alert box; the "disclaimer". I tried just adding header tags and bold tags to it, but those just generate the text and not the actual styles.
Here's the code I'm using, its just a very simple alert box script.. if you have a better idea, please let me know.
<SCRIPT language="JavaScript">
<!--
function go_there()
{
var where_to= confirm("DISCLAIMER TEXT WILL GO HERE");
if (where_to== true)
{
window.location="http://mcgehee.ace-onecomputers.com/nlphpmail.php";
}
else
{
}
}
//-->
HTML:
<button class="button" id="submit" value="send" type="submit" name="submit" onClick="go_there()">Send</button>
Also, another issue i'm having with this is that instead of it just closing the dialog box, it still continues the script.

You cannot style alert or confirm box. You have to use DHTML box.
Using Impromptu
Try this, I used jQuery Impromptu plugin http://trentrichardson.com/Impromptu/
Demo: http://jsfiddle.net/muthkum/4h8cX/6/
For full code, check out page source on http://fiddle.jshell.net/muthkum/4h8cX/6/show/
Using smoke.js
Demo: http://jsfiddle.net/muthkum/8qXsv/3/
UPDATE:
Here is the full code using jQuery Impromptu
You can see, I've included jquery-1.8.2.js and jquery-impromptu.4.0.min.js. Also styles are included in the below codes. I hope this helps.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo by muthkum</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.js'></script>
<script type='text/javascript' src="http://trentrichardson.com/Impromptu/scripts/jquery-impromptu.4.0.min.js"></script>
<style type='text/css'>
/*
------------------------------
Impromptu
------------------------------
*/
.jqifade{
position: absolute;
background-color: #777777;
}
div.jqi{
width: 400px;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
position: absolute;
background-color: #ffffff;
font-size: 11px;
text-align: left;
border: solid 1px #eeeeee;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
padding: 7px;
}
div.jqi .jqicontainer{
font-weight: bold;
}
div.jqi .jqiclose{
position: absolute;
top: 4px; right: -2px;
width: 18px;
cursor: default;
color: #bbbbbb;
font-weight: bold;
}
div.jqi .jqimessage{
padding: 10px;
line-height: 20px;
color: #444444;
}
div.jqi .jqibuttons{
text-align: right;
padding: 5px 0 5px 0;
border: solid 1px #eeeeee;
background-color: #f4f4f4;
}
div.jqi button{
padding: 3px 10px;
margin: 0 10px;
background-color: #2F6073;
border: solid 1px #f4f4f4;
color: #ffffff;
font-weight: bold;
font-size: 12px;
}
div.jqi button:hover{
background-color: #728A8C;
}
div.jqi button.jqidefaultbutton{
background-color: #BF5E26;
}
.jqiwarning .jqi .jqibuttons{
background-color: #BF5E26;
}
</style>
<script type='text/javascript'>//<![CDATA[
function go_there(){
$.prompt('<b>DISCLAIMER</b> <span style="font-weight:normal">TEXT WILL GO HERE</span>',{
buttons: { Ok: true, Cancel: false},
callback: function(e,v,m,f){
if(v){
window.location="http://mcgehee.ace-onecomputers.com/nlphpmail.php";
}else{
}
}
});
}
//]]>
</script>
</head>
<body>
<button class="button" id="submit" value="send" type="submit" name="submit" onClick="go_there()">Send</button>
</body>
</html>
​

Related

CSS not showing up when HTML loaded

I am having an issue linking my CSS to HTML on my computer. My html file has the correct link and name for the CSS file but when I open by HTML file in chrome there is no styling. If I open up dev tools after that and go to source, only my js and html file show in the folder even though there is json, css, html, and js file in the project folder. The CSS file name is index.css, the js file name is index.js, and the html file name is index.html. If you know what could be wrong please let me know. I ran both files here and they work here but not when I try and run my html file on chrome.
CODE:
body {
margin: 0;
padding: 10px;
font-family: Arial, Helvetica, sans-serif;
min-width: 400px;
}
input {
width: 100%;
padding: 10px;
box-sizing: border-box;
border: 1px solid #5f9341;
margin-bottom: 4px;
}
button {
background: #5f9341;
color: white;
padding: 10px 20px;
border: 1px solid #5f9341;
font-weight: bold;
}
#delete-btn {
background: white;
color: #5f9341;
}
ul {
margin-top: 20px;
list-style: none;
padding-left: 0;
}
li {
margin-top: 5px;
}
a {
color: #5f9341;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link src="index.css" ref="stylesheet" type: "text/css">
</head>`enter code here`
<body>
<input type="text" id="input-el">
<button id="input-btn">SAVE INPUT</button>
<button id="tab-btn">SAVE TAB</button>
<button id="delete-btn">DELETE</button>
<ul id="ul-el">
</ul>
<script src="index.js"></script>
</body>
</html>
Instead of "src" it needs to be "href", and "type:" must be "type="
<link href="index.css" rel="stylesheet" type="text/css">

How to show another div when clicking on a div?

Good afternoon ,
I know this question has been asked a lot of times here, but all the answers there are not working for the problem I have.
I have a div called .title3 . When the user clicks it I want another div called .Content3 to be shown . But unfortunatelly it doesn't work the way I want to.
Here is a part of my html code where I found this problem :
<body style="background-color:#171717">
<div class="pseudo3">
<div class="one3">
<div class="Content3">
<p class="close">X</p>
<form action="order.php">
<input type="text" value="First & Last Name">
<input type="email" value="Your e-mail">
<input type="text" value="Your phone number">
<textarea>Write your feedback here</textarea>
<button>Send</button>
</form>
</div>
<div onmouseclick="showDiv()" class="title3">
FEEDBACK
</div>
</div>
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
function showDiv() {
var x = document.getElementsByClassName("title3");
if ( x.click === true ){
document.getElementsByClassName("Content3").style.display = "block";
}
}
</script>
</body>
CSS:
/* The Form Style */
form {
width: 100%;
height: 100%;
}
form input {
width: 100%;
height: 35px;
color: #8b8b8b;
font-family: 'Lato', sans-serif;
background-color: #171717;
padding: 12px;
border: 0;
outline: none;
border-top: 0.15px solid #262323;
border-left: 0.15px solid #262323;
border-right: 0.15px solid #262323;
}
form textarea {
min-width: 100%;
max-width: 100%;
min-height: 200px;
max-height: 200px;
color: #8b8b8b;
font-family: 'Lato', sans-serif;
background-color: #171717;
padding: 12px;
border: 0;
outline: none;
border-top: 0.15px solid #262323;
border-left: 0.15px solid #262323;
border-right: 0.15px solid #262323;
}
form button {
width: 100%;
height: 45px;
position: relative;
top: -3px;
color: #8b8b8b;
font-family: 'Lato', sans-serif;
background-color: #171717;
border: 0.15px solid #262323;
outline: none;
font-size: 20px;
}
input:focus,
textarea:focus,
button:focus{
background-color: #212020;
border-top: 0.15px solid #1f1616;
border-left: 0.15px solid #1f1616;
border-right: 0.15px solid #1f1616;
}
/* Content3 style */
.Content3 {
width: 300px;
height: 350px;
position: absolute;
z-index: 2;
display:none;
}
/* one3 style */
.one3 {
width: 300px;
height: 350px;
transition: 0.3s ease;
position: relative;
background-color: #141414;
}
/* pseudo3 style */
.pseudo3 {
width: 320px;
padding: 10px;
border-top: 2px solid #b95e1c;
border-bottom: 2px solid #ad7145;
background-image:
linear-gradient(#b95e1c, #ad7145),
linear-gradient(#b95e1c, #ad7145);
background-size: 2px 100%;
background-position: 0 0, 100% 0;
background-repeat: no-repeat;
}
/* title3 style */
.one3 .title3 {
padding: 30px;
font-size: 24px;
color: #8b8b8b;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
/* close style */
.close{
color: #8b8b8b;
font-size: 24px;
position:absolute;
left:-11px;
top:-62px;
z-index:3;
border-top: 0.5px solid #1f1616;
border-left: 0.5px solid #1f1616;
border-right: 0.5px solid #1f1616;
border-bottom: 0.5px solid #1f1616;
padding:10px 17px;
background-color:#212121;
transition: 0.2s ease-in-out;
}
.close:hover{
background-color: #8b8b8b;
color:#212121;
cursor:pointer;
transition: 0.2s ease-in-out;
}
JavaScript:
function showDiv() {
var x = document.getElementsByClassName("title3");
if ( x.click === true ){
document.getElementsByClassName("Content3").style.display = "block";
}
}
There are no error messages, but when I click my .title3 div it's not showing the div with class .Content3
You have many problems in your code. I will try to cover most of them
You use onmouseclick. That is not a valid javascript event. Use onclick.
You are trying to assign to variable x the HTML element with class title3. Here are 2 problems:
2.1. You do not need to assign the element you just clicked on to a variable inside the click function. You already have that element with event.target
2.2. By using getElementsByClassName you get a HTML Collection not a single element. ( see the plural Elements word ) You can get it using querySelector or by adding an id to it and use getElementById ( see the singular Element ). But again, you do not need to retrive it like that. You can use the event.target. As you click on it.
if ( x.click === true ){ . Why you need to check if the element is clicked, when the entire function is called only when that element is clicked ? Redundant check and not correct.
here again. See point 2.2
do not name your HTML attributes with capital letters. use content3
Do not import jquery, as you do not need it.
Check code below
function showDiv() {
document.querySelector(".Content3").style.display = "block";
}
.Content3 {
display:none
}
<div class="pseudo3">
<div class="one3">
<div class="Content3">
<p class="close">X</p>
<form action="order.php">
<input type="text" value="First & Last Name">
<input type="email" value="Your e-mail">
<input type="text" value="Your phone number">
<textarea>Write your feedback here</textarea>
<button>Send</button>
</form>
</div>
<div onclick="showDiv()" class="title3">
FEEDBACK
</div>
</div>
</div>
Useful links:
onclick event
getElementsByClassName
querySelector
event.target
You dont need jQuery to do that, you can also delete your onmouseover and use just this:
<script>
//add listener for click on your .title3
document.getElementsByClassName("title3")[0].addEventListener('click', function(e){
//prevent default action if any (dont need that in this case, but useful, if .title3 would be <a> tag)
e.preventDefault();
//set style
document.getElementsByClassName("Content3")[0].style.display = "block";
});
</script>
Can you use data property for this topic.
<div class="titles">
<button data-id="1">open 1</button>
<button data-id="2">open 2</button>
<button data-id="3">open 3</button>
</div>
<div class="contents">
<p data-id="1">context</p>
<p data-id="2">context</p>
<p data-id="3">context</p>
</div>
When any button clicked, take data-id and do anything inside of contents div with data-id. If you cannot understand I can send any example for this.

JS: Can't click one element to trigger click on another

I followed the examples that I found but for some reason clicking on the above div won't trigger a click on the below input. Can someone tell me where I'm going wrong?
$(document).on('click', '#uploader', function(event) {
$("#url").click();
});
#uploader {
width: 480px;
height: 100px;
line-height: 100px;
border: 2px dashed #443d66;
cursor: pointer;
color: #777;
font-family: 'Arial';
font-weight: bold;
text-align: center;
margin-bottom:10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<div id="uploader">
Click
</div>
<input type="text" name="url" id="url">
</body>
</html>
If you need the click to focus on the #url element, use .focus() instead of .click():
$(document).on('click', '#uploader', function(event) {
$("#url").focus();
});
#uploader {
width: 480px;
height: 250px;
line-height: 250px;
border: 2px dashed #443d66;
cursor: pointer;
color: #777;
font-family: 'Arial';
font-weight: bold;
text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<div id="uploader">
Click
</div>
<input type="text" name="url" id="url">
</body>
</html>
$(document).on('click', '#uploader', function(event) {
$("#url").click();
});
#uploader {
width: 480px;
height: 250px;
line-height: 250px;
border: 2px dashed #443d66;
cursor: pointer;
color: #777;
font-family: 'Arial';
font-weight: bold;
text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<div id="uploader">
Click
</div>
<input type="file" name="url" id="url" onclick="console.log('clicked!!')">
</body>
</html>
I guess you want to open native file browser window on click. Check the snippet, there in an click handler attached to the input too.
You can use this for further processing.
I hope on click of div you want to show file upload window.
For that Convert type="text" to type="file" and it will work fine.
Working snippet:-
$(document).on('click', '#uploader', function(event) {
$("#url").click();
});
#uploader {
width: 480px;
height: 250px;
line-height: 250px;
border: 2px dashed #443d66;
cursor: pointer;
color: #777;
font-family: 'Arial';
font-weight: bold;
text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<div id="uploader">
Click
</div>
<input type="file" name="url" id="url">
</body>
</html>
Note:-
Your code is working fine, but there is no click handler written to catch that event. So notting happening
You can assure by adding click handler to your code like below:-
$(document).on('click', '#uploader', function(event) {
$("#url").focus(); // you can apply .click() too
});
/* for click add the even handler like below
$('#url').click(function(){
$(this).val('Hey click worked!').focus();
});
*/
#uploader {
width: 480px;
height: 250px;
line-height: 250px;
border: 2px dashed #443d66;
cursor: pointer;
color: #777;
font-family: 'Arial';
font-weight: bold;
text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<div id="uploader">
Click
</div>
<input type="text" name="url" id="url">
</body>
</html>
Instead of this
$(document).on('click', '#uploader', function(event) {
$("#url").click();
});
Use like this
$(document).on('click', '#uploader', function(event) {
$("#url").trigger('click);
});
Are you missing an click event for the #url element?
When triggering a click event for an element using .click() you have to define an actual click event for it.
$(document).on('click', '#uploader', function(event) {
$("#url").click();
});
$("#url").click(function(){
alert('asd');
});
This could be the only reason, unless the scripts aren't loaded properly, or you are getting some errors while running your JS.
See: JSFiddle
In case you want the click event to focus on your input element, you'd use .focus(), as described in a previous answer written by Alive to Die.
See: JSFiddle
Click & Focus, just modify few code
$('#uploader').on('click', function(event) {
$("#url").click().focus();
});
#uploader {
width: 480px;
height: 100px;
line-height: 150px;
border: 2px dashed #443d66;
cursor: pointer;
color: #777;
font-family: 'Arial';
font-weight: bold;
text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<div id="uploader">
Click
</div>
<br>
<input type="text" name="url" id="url" onclick="alert('clicked!!')">
</body>
</html>

How can I Validate forms with jquery?

Thanks to some awesome people on stack overflow i was able to get my classes toggled and got my form slide up and down correctly. I'm having issues validating the form before it becomes submitted. Could someone help me with a step in the right direction? I just want the validation to check that the fields have some text in them before allowing the submit.
Assignment 6
<!-- video https://youtu.be/XEoWYcolaEM -->
<style>
body {
background-color: #fff;
font-family: arial, sans-serif;
font-size: 100%;
}
a {
color: blue;
}
#welcome p strong {
color: navy;
font-size: 1.2em;
}
#welcome p:first-of-type {
margin-bottom: 50px;
}
section {
margin-bottom: 50px;
}
/* main container */
#main {
width: 960px;
margin: 50px auto;
border: 2px solid #000;
padding: 20px;
background-color: #e0e0ff;
position: relative;
box-sizing: border-box;
}
/* form container */
#loginDiv {
width: 300px;
position: absolute;
left: 650px;
top: 6px;
z-index: 100;
border: 1px solid navy;
}
/* paragraph that shows the text "Login" which is clicked on to display/remove the form */
#login {
margin: 0;
cursor: pointer;
background-color: rgb(255,255,255);
padding: 5px 0 2px 30px;
}
#login:hover {
background-color: rgb(110,138,195);
}
/* plus sign icon for login form */
.plus {
background: url(img_open.png) no-repeat 8px 7px;
background-color: rgb(110,138,195);
}
/* minus sign icon for login form */
.minus {
background: url(img_close.png) no-repeat 8px 7px;
}
/*form is hidden when the page loads */
#loginDiv form {
padding: 10px 10px 10px 10px;
display: none;
background-color: rgb(255,255,255);
}
#loginDiv label {
display: block;
width: 100px;
margin: 0 15px 0 0;
}
#loginDiv input {
font-size: 1.2em;
border: 1px solid navy;
}
#loginDiv input:focus {
background-color: rgb(110,138,195);
border: 2px solid navy;
}
#loginDiv input[type=button] {
width: 100px;
}
footer {
text-align: center;
margin-top: 50px;
margin-bottom: 10px;
padding: 20px;
border-top: 1px solid #000;
}
/* ad is not shown when the page loads */
#ad {
width: 300px;
height: 300px;
border: 1px solid #000;
background-color: yellow;
position: absolute;
left: 330px;
top: -500px; /* you can change this inbitially for viewing purposes only but be sure to set it back */
box-sizing: border-box;
background-image: url(ad.jpg);
background-repeat: no-repeat;
}
/* close button on ad */
#adbtn {
width: 50px;
height: 50px;
border: 2px solid #000;
border-top-width: 1px;
border-right-width: 1px;
background-color: #fff;
font-size: 3em;
text-align: center;
cursor: pointer;
box-sizing: border-box;
position: absolute;
top: 0px;
right: 0px;
}
</style>
<script src="jquery-1.12.3.min.js" type="text/javascript"></script>
<script>
//Fading in Advertisent
$(document).ready(function(){
$("#ad").animate({
top: '100px',
},(5000));
//Closing The Advertisement
$("#adbtn").click(function(){
$("#ad").fadeOut(5000);
});
$(".plus").click(function(){
$("form").slideToggle(1000); // half second duration
$(this).toggleClass("plus").toggleClass("minus");
$('button').click(function(){
$("form").val(1);
});
}); // end function
}); // end function
</script>
</head>
<body>
<!-- main container -->
<div id="main">
<section id="loginDiv">
<!-- when this is clicked on the below form should be displayed and plus sign should change to minus sign-->
<p id="login" class="plus">Login</p>
<form>
<p>
<label for="username">Username:</label>
<input type="text" name="username" id="username">
</p>
<p>
<label for="pw">Password:</label>
<input type="password" name="pw" id="pw">
</p>
<p>
<input type="button" value="Submit">
</p>
<!-- placeholder for response if form data is correct/incorrect -->
<p id="error"> </p>
</form>
</section>
<section id="welcome">
<h1>Welcome to the Local jQuery User Group Website</h1>
<p> <strong>Click the login button at the top of the page to login. To become a member please Register</strong> </p>
<h2>About this page layout:</h2>
<p> The main container (parent) has 'relative' positioning so that the 'login' container can be absolutley positioned with respect to
that main container. Otherwise, it would default to being absolutley positioned with respect to the window. </p>
<p> In order for the login panel to be placed on top of the page we need to use absolute positioning, otherwise,
it would move the rest of the content down as done in the FAQ assignment. Technically, absolute positioning takes that element out of
the normal flow of the document, so that it is on top of the page. The 'ad' is also absolutely positioned to the same main container. </p>
</section>
<section>
<h2>This week's agenda:</h2>
<p>There will be a live meeting this Tuesday evening from 7:00pm to 8:00pm PST using our WebEx Conferencing Software.
It will be recorded! Please note that the code samples will be available on our GitHub repository. </p>
</section>
<footer> Copyright © Local jQuery User Group </footer>
<!-- ad which is absolutely positioned -500px from the top so you do not see it when page loads-->
<div id="ad">
<div id="adbtn"> X </div>
</div>
<!-- end main container -->
</div>
</body>
</html>
Take a look into jQuery Validate.
This jQuery plugin makes simple clientside form validation easy, whilst still offering plenty of customization options.
I hope you can learn from this. I'll just give you an example with one of your fields and a submit button. Initially the submit button is disabled, then you can use the keypress event to check if 1 or more characters are entered and enable the submit button.
Fiddle: https://jsfiddle.net/stevenng/8w89v3tp/1/
HTML:
<label for="username">Username:</label>
<input type="text" name="username" id="username">
<button class="js-submit">submit</button>
JS:
var $submit = $('.js-submit');
var $username = $('#username');
$submit.attr('disabled', true);
$username.keypress(function() {
if ( $username.val().length > 0 ) {
$submit.attr('disabled', false);
}
});
$submit.on('click', function(){
// do something
});

Greyout background onclick of button to display popup

I have a page where clicking on the button it should greyout the background and the popup msg should be displayed over the greyout area..What im getting now is popup displayed over the alone background is not greyout .
This the script and style im applying
<script>
function deselect() {
$(".pop").hide();
}
$(function () {
$("#decline").live('click', function () {
$(".pop").css({ "display": "block", opacity: 0.7, "width": $(document).width(), "height": $(document).height() });
$(".pop").show();
});
$("#close").live('click', function () {
deselect();
return false;
});
});
</script>
<style type="text/css">
.messagepop {
background-color: #FFFFFF;
border: 1px solid #999999;
cursor: default;
display: none;
margin-top: -39em;
margin-left: 26em;
position: absolute;
text-align: left;
width: 394px;
z-index: 50;
padding: 25px 25px 20px;
}
.popuptxt {
display: block;
margin-bottom: 3px;
padding-left: 15px;
text-indent: -15px;
font-weight: 700;
}
.popupbtn {
padding-top: 15px;
padding-left: 135px;
}
.messagepop p, .messagepop.div {
border-bottom: 1px solid #EFEFEF;
margin: 8px 0;
padding-bottom: 8px;
}
</style>
THis html code
<input id="decline" type=button name="Decline" value="Decline">
<div class="messagepop pop">
<span><font class="popuptxt">By clicking decline, download will not occur, and window will close</font></span>
<div class="popupbtn">
<input type="button" name="Ok" class="btn btn-sm btn-orange" value="<%=labelutils.printTranslatedValues("Ok")%>" onclick="window.open('', '_self', ''); window.close();">
<input id="close" type="button" name="Cancel" class="btn btn-sm btn-gray-dark" value="<%=labelutils.printTranslatedValues("Cancel")%>">
</div>
</div>
Your code was a mess.
.live() doesn't exist, I replaced that with .on()
I made your popup fixed instead of absolute and positioned it correctly
Instead of using opacity, you should use a semitransparent background color, otherwise the contents of the element also become semi-opaque.
I also cleaned up your JS a little bit to make it easier to manage.
I also removed that on-click function you had on that OK-button - I'd advice against using that with user-friendliness in mind
function deselect() {
$(".pop").hide();
return false;
}
function select(){
$(".pop").css({
display: "block",
opacity: 1,
width: $(document).width(),
height: $(document).height()
});
$(".pop").show();
}
$(function () {
$("#decline").on('click', select);
$("#close").on('click', deselect);
});
.messagepop {
background-color:rgba(255,255,255,.7);
border:1px solid #999999;
cursor:default;
display:none;
position:fixed;
top:0;
left:0;
text-align:left;
width:394px;
z-index:50;
padding: 25px 25px 20px;
}
.popuptxt {
display: block;
margin-bottom: 3px;
padding-left: 15px;
text-indent: -15px;
font-weight: 700;
}
.popupbtn {
padding-top: 15px;
padding-left: 135px;
}
.messagepop p, .messagepop.div {
border-bottom: 1px solid #EFEFEF;
margin: 8px 0;
padding-bottom: 8px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="decline" type=button name="Decline" value="Decline">
<div class="messagepop pop">
<span>
<font class="popuptxt">
By clicking decline, download will not occur, and window will close
</font>
</span>
<div class="popupbtn">
<input type="button" name="Ok" class="btn btn-sm btn-orange" value="OK">
<input id="close" type="button" name="Cancel" class="btn btn-sm btn-gray-dark" value="Cancel">
</div>
</div>
Found two issues:
Looks like the 'live' function you're using doesn't exist in jQuery since version 1.9. So unless it's coming from some other library, that's where you're main problem is.
Your .messagepop div isn't positioned correctly, and hence doesn't show up on-screen. You want the parent element to have position:relative, and then set position:absolute on .messagepop and top:0; left:0 to align it correctly.
Rudimentary working version here: http://jsfiddle.net/xj3pL213/

Categories

Resources