Issue with Jquery Popbox Conflict

I have two buttons that trigger the appearance of a <div> like a pop-up box.

I successfully set up the first button to display a <div> named bigbox, but when I try to click on the second button, it doesn't show another <div> called editbox.

However, when I removed the jQuery function controlling the first button, it started working for the second button.

<html>
<head>
    <title>Page</title>
    <script type="text/javascript" src="jquery-1.9.1.min.js"></script>

    <style type="text/css">


        .bigbox  {
            background-color: #F5E49C;
            color: #000;
            padding: 0 5px;
            width:280px;
            text-align: center;content: "";display: none;
            padding-bottom: 30px;
            padding-top: 10px;
        }

        .editbox  {
            background-color: #F5E49C;
            color: #000;
            padding: 0 5px;
            width:280px;
            height:500px;
            text-align: center;content: "";
            display: block;
            padding-bottom: 70px;
            padding-top: 10px;
            position: absolute;left:300px;top:1px;
        }


    </style>
</head>
<body>
    <button id="ClickMe">Click Me</button>
    <div id="moveableBox" data-display="hidden" class="bigbox">
    </div>
    <br>
    <button id="Click">Second pop box</button>
    <div id="ableBox" data-display="hidden" class="editbox">
    </div>
    <script type="text/javascript">
        jQuery(document).ready(function ($) {
            $("#ClickMe").click(function (e) {
                e.preventDefault();
                /*if (.attr("data-display") == "visible") {};*/
                $("#moveableBox").fadeToggle();
            });
            $("#moveableBox").draggable({
                handle: "#moveBox"
            });
        });
    </script>
</body>
</html>

Answer №1

Initially, an error is appearing in the browser console:

Uncaught TypeError: Object [object Object] has no method 'draggable' 

To resolve this issue, you can either import jquery-ui or remove the draggable methods from your code.

Additionally, ensure that the toggle function on #ableBox is correctly implemented to prevent it from disappearing when initially visible.

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

having trouble accessing a JavaScript array in AngularJS

Hey there, I'm currently working on a web application using AngularJS and I'm facing an issue with querying arrays. Check out the code snippet below: var angulararray = []; bindleaselistings.bindleaselistingsmethod().then(function(response) { ...

Unshifting values in a JavaScript array only if they exist in another array

I have two arrays of objects - one containing selected data and the other containing general data that needs to be displayed General data for display const arr = [ { id: "1", name: "Skoda - Auto" }, { id: "2" ...

Issue with Material UI: An invalid value was detected for the select component, even though the value is within the available options

I am facing an issue with a dropdown list component using material UI. The dropdown is populated by an API call and displays a list of departments with their corresponding IDs and names. Upon selecting a record from a table, the department name associated ...

How to change the background color of select options using JQuery

My webpage includes multiple select boxes with different options: <select name="item-0-status" id="id_item-0-status"> <option value="">---------</option> <option value="1">Online</option> <option value="2">Offline</o ...

Conditionals are always evaluated as true

After writing this post function in my jQuery plugin, I encountered a peculiar issue. I have a doubt about the condition statement in this jQuery code. Can you confirm if it is correct? if(info = "enabled"){ $("#mod"+mod_id+" > img.status").attr(" ...

Exclude crypto-browserify from the NextJS build process

I have been dedicated to minimizing the build size of my app as much as possible, and I have observed that the crypto-browserify module is consuming a significant amount of space. While I understand that Next.js polyfills the node module if necessary, I wo ...

What is the method to identify the test case name as passed or failed in Puppeteer?

I am currently working on integrating the puppeteer-jest test framework with TestRail using TestRail API. To accomplish this task, I need to identify which tests have failed and which tests have passed. Despite searching through the official GitHub Reposi ...

Cheerio uses CSS selectors to target specific image sources within the HTML document

I'm having trouble extracting a specific src attribute const img1 = selector .find("li.gallery_thumbItem.s-gallery_thumbItem:nth-child(3) span.gallery_thumbIn> img:last-child") .attr("src"); The webpage contains: https://i.sstatic.net/zeBPG ...

AngularJS JQ Widgets Chart Display Issue

Trying to incorporate a chart using JQ widget, the code snippet below shows my controller code. When making an ajax call to retrieve data from the server, the response is received but the chart displays the previous data of that variable as undefined. Hard ...

Ionic - Error: SyntaxError: Unexpected token caught

I am currently utilizing Ionic Framework version 1.7.16 The error on Android is pinpointed to the following line of code var obj = {[$myid] : firebase.database.ServerValue.TIMESTAMP}; No error occurs when the line above is changed to the following var ...

Discover the method to retrieve the month name from an HTML Date input value

Here we have a date input field <input id="customer-date" name="customer-date" type="date" required> Accompanied by this script const customerDate = document.getElementById('customer-date').value; const dateHandler = document.getElementB ...

ERROR: No compatible version of jQuery Foundation could be located

Encountering issues while installing Foundation due to conflicts with Jquery. λ bower install foundation bower foundation#x cached https://github.com/zurb/bower-foundation.git#5.5.1 bower foundation#x validate 5.5.1 against https: ...

Creating a personalized look for your website using Rails 3.2 Asset Pipeline, a custom theme

Seeking assistance as I am struggling to get my CSS files loaded correctly in production for my 3.2 RoR app. Despite trying various methods, the files either do not appear or result in a 404 error. My application utilizes a combination of a purchased them ...

Dealing with Redis session management in the event of a database disconnection

Having trouble with losing connection to Redis, which is used for sessions in my Express App. var RedisStore = require('connect-redis')(express); sessionStore = new RedisStore(config.db.redis.connection); sessionStore.client.on('error' ...

My goal is to create a stylish form using bootstrap and CSS3

I am aiming to replicate the layout of this particular page: https://i.sstatic.net/HxOhC.png Struggling to utilize css3 for designing, how can I achieve a form similar to this? Facing difficulty in creating the outer red border and inserting spacing betw ...

Is there a way to retrieve SQL information through an API and then incorporate that data into react-native-svg charts? I have an API that contains data I would like to retrieve and showcase

I am utilizing an API to retrieve data, which includes the execution of SQL queries. The API is responsible for fetching data and running these queries. I am looking for a way to replace the static data in my charts with dynamic data fetched from the API. ...

Using the jQuery val() Function with a User-Defined Object

I have a class named ValueBox with a custom val() method that I implemented as shown below: function ValueBox(params) { ... $.extend(true, this, $('/* some HTML elements */')); ... var $inputBox = $('input[type=text]', this ...

embedding a scrollable section within a stationary container

I'm facing an issue with two divs where I need the parent to be fixed and the child to be scrollable. CSS for the parent div: aside{ height: 100%; float: left; width: 25%; position: fixed; border-style: solid; border-right-col ...

Angular7 & Electron: Resolving the Issue of Loading Local Resources

I am encountering difficulties while working with electron. Although I can successfully load my project using ng serve, I encounter an error when attempting to open it with electron as shown in the developer tools Not allowed to load local resource: fil ...

Utilizing jQuery to extract information from a JSON string

Currently, I have a set of records stored in an Oracle table and I am retrieving them using the following PHP code: $json_OutputArray = array(); while ($result = oci_fetch_assoc($parse_submitted_list)) { $json_OutputArray[] = $result; } $jsonstring ...