The jQuery hide method is not functioning as expected

Looking for a unique pop-up window to display on my homepage with the option to close it by clicking an X button. Here is the custom CSS:

.sign-up-modal {
width: 590px;
height: 464px;
position:fixed;
z-index:700;
top:180px;
left:50%;
background-image: url('images/youtubeconsole.png');
margin-left:-295px;
display:block;
}

.modalbackground {
width:100%;
height:100%;
background-image: url('images/modalbackground.png');
background-repeat: repeat;
position:fixed;
z-index:99999;
}

.youtubexbutton {
bottom: 12px;
right:13px;
position:absolute;
width:26px;
height:26px;
background-image:url('images/youtubex.png');
}

.youtubexbutton:hover {
background-image:url('images/youtubex-hover.png');
cursor:pointer;
}

Implemented in WordPress, inside header.php:

<script>

jQuery(document).ready(function(){

    jQuery('.youtubexbutton').click(function(){
    jQuery('.sign-up-modal').hide();
    });

    jQuery('.youtubexbutton').click(function(){
    jQuery('.modalbackground').hide();
});

}


</script>

On the homepage:

<div class="sign-up-modal">
<div class="youtubexbutton"></div>
</div>  

While the modal window shows up, clicking on youtubexbutton doesn't work as expected. The goal was for both .modalbackground and .sign-up-modal to disappear upon clicking.

Answer №1

Error in syntax detected. The missing character is ):

jQuery(document).ready(function(){

    jQuery('.youtubexbutton').click(function(){
    jQuery('.sign-up-modal').hide();
    });

    jQuery('.youtubexbutton').click(function(){
    jQuery('.modalbackground').hide();
});

})

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with fluid layout in CSS - Unable to specify height in pixels and minimum height property not functioning as expected

While working on a liquid layout, I have set all my width and height values in percentages. However, during the design process, I needed to check how my CSS was rendering so I temporarily set the height in pixels. Eventually, the height in percentage wil ...

Tips on implementing JSON data into select2 plugin

I have been trying to integrate the select2 plugin into my project. I followed a tutorial from this link, but unfortunately, it's not functioning properly for me. Here is the JSON output: [ {"ime":"BioPlex TM"}, {"ime":"Aegis sym agrilla"}, ...

HTML/JS: Date and Time Tracker

Is there a way to use pure JS or bootstrap to create a component that can display a formatted date string based on provided instructions? For instance: <div class="my-datetime-formatter-and-display-er" value="Thu 30 Apr 20:12:08 EEST 2020" format ...

Is there a way to stop the execution of myFunc after it has been performed 5 times using clearInterval?

This code is designed to notify online shoppers that they need to choose a color from a dropdown menu before adding an item to their shopping cart. If no color is selected, the text will blink to alert them. How can I modify this code so that the blinking ...

Utilize separate CSS files in React components for better organization

Hello, I have encountered an issue with splitting my components and using react-router-dom. I decided to split the CSS for each component, such as Main.jsx - Main.css and CustomerBase.jsx - customerbase.css. However, the problem I am facing is that the CSS ...

Contrasting the slice method with the get method

As I delved into a book, I stumbled upon a code snippet involving the slice method: $('*').slice(2,3); Initially, it appeared to be a straightforward command - select all elements on the page and then return the third element. However, the book ...

Struggling to close modal popup after submitting form

click here for imageCurrently, I am working with the bootstrap modal plugin to create an inquiry form. The issue I am facing is that even though I am using the "ng-submit" directive to save the form details, when I click submit, the form submits successful ...

Unlocking the potential of data inputted in a JQuery Autocomplete form

Seeking assistance with extracting data from a form to utilize for additional purposes <form onsubmit="return false;"> Enter a School: <input id="schoolsearch" type="text" /> <INPUT TYPE=SUBMIT VALUE="GO"> </form> I am struggling ...

Images cannot be shown until they have been uploaded

My issue involves a menu that loads an external file (form) on the same page, and for the menu, I am utilizing a specific function for menu styling. Custom Menu Function function getXmlHttp() { try { return new ActiveX ...

Having trouble with smart_selects in Django - the second level isn't populating properly

I am having trouble populating the second level (subcategory/E_cat) drop down. The first level (Category) dropdown seems to be working fine. I have tried multiple combinations of chained_field and chained_model_field selections without success. My goal is ...

What is the best way to emphasize a table column when a cell is selected?

I successfully implemented a feature where a cell (td-element) is highlighted when clicked by the user. However, I now want the entire column to be highlighted with the cell itself having a slight variation. I am struggling with achieving the last part ...

Switch the text style when hovering, then switch it back upon second hovering

Searching for a method to modify the font of individual letters when hovering over them. The goal is for the letters to revert back to their original font after a second hover (not on the first hover-off). Any assistance would be greatly valued! ...

The jQuery ajax call is returning some undefined results, which is in contrast to the network response, which appears to be completely accurate

My system utilizes an oracle-db and a php-script that is triggered by a query ajax-call. Here is the php-script: $query = 'SELECT pl.event_id, pl.og2, d.name dst, pl.state, pl.note, pl.createdate FROM publevels pl LEFT JOIN dst d on (d.og2 = pl.og ...

My desire is for every circle to shift consecutively at various intervals using Javascript

I'm looking to draw circles in a sequential manner. I am trying to create an aimbooster game similar to . Instead of drawing all the circles at once, I want each circle to appear after a few seconds. The circles I've created currently do not g ...

Troubleshooting problem with sorting dates in MVC jQuery datatable

I have successfully implemented a datatable in MVC3 using c#. Everything was working perfectly on my local development machine, including the sorting of DateTime columns. However, when I uploaded the code to the server and accessed the webpage, I encounte ...

Why do Jquery Ajax calls stop working after the first successful call?

Currently, I am utilizing jQuery to create a personalized email system which features a left panel displaying a list of messages and a right side showing the selected or current message. However, after performing an Ajax call (such as deleting a message an ...

Instant hover response in the dropdown menu feature of 'bootstrap4'

Despite numerous attempts, I cannot seem to add a delay to the dropdown-menu in my navigation bar. The other parts of the menu are working perfectly with a nice delay. I've tried including "jQuery .dropdown-menu .delay(400)" and also added "transitio ...

Guide on incorporating mouse movement while the mouse button is held down in JavaScript

For my project, I want to activate the mouse move event only when the mouse button is held down. I specifically need the action "OK Moved" to be triggered only when both the mouse button is held down and there is mouse movement. This is the code that I h ...

ASP.NET has not yet caught a glimpse of the Ajax arguments

I am currently sending Ajax arguments from one ASP.NET page to another. The code snippet I am using is as follows: $('#sourcePageBtn').click( function() { $.post('destination.aspx', { name: "John", time: "2pm" }, function(data) { ...

Place a list with scrolling and overflow features side by side

Having trouble getting my headers to scroll with overflow auto and white-space nowrap. Can't figure out why it's not working. I want to create hyperlinks within headers to link to specific parts of the website. I have the code for hyperlinking s ...