What is causing the hiding of the element without loading any content into the iframe?

Can you lend a hand? I have a snippet of code that looks like this:

<head>
        <meta charset="utf-8">
        <title></title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href='https://fonts.googleapis.com/css?family=Raleway:300' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" type="text/css" href="hexagons.css">
        <script src="jquery-3.2.1.min.js"></script>
        <script type="text/javascript">
//            function disp(){
//                document.getElementById('hexGrid').style.display = 'none';
//            }
        </script>
    </head>
    <body>
   <iframe name="display" id="display_template"></iframe>

    <ul id="hexGrid">
        <?php
        foreach ($dirs as $link) {
            if ($link != 'assets') {
            echo '
            <li class="hex">
                <div class="hexIn">
                    <a class="hexLink" href="'.$linkArray[$link].'" onclick="disp(); return false;" target="display" >
                        <img src="assets/dir.png" alt="'.$link.'" />
                        <h1>' . $link . '</h1>
                        <p>Redirect to template</p>
                    </a>
                </div>
            </li>
            ';
            }
        }
        ?>
    </ul>
    </body>

I am trying to make it so that clicking on the link in #hexGrid will hide the grid and load content into an iframe simultaneously.

When I comment out the JavaScript function, clicking on the link loads the selected content correctly onto the iframe. However, when the JavaScript is active, it only hides #hexGrid without loading anything into the iframe.

Any thoughts on what might be causing this issue? :)

Answer №1

Discover the correct solution by changing onclick="disp(); return false;" to onclick="disp(); return true;"

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

Column with a set width in Bootstrap

Is it possible to create a fixed width right column in Bootstrap while keeping the left column responsive? I am currently working with Bootstrap 2.3.2 https://i.stack.imgur.com/xOhQo.png (source: toile-libre.org) I want the right column to maintain it ...

Repeat the most recent AJAX request executed

I am currently working on refreshing a specific section of my application which is generated by an AJAX call. I need to target the most recent call that was made and rerun it with the same parameters when a different button is clicked. The data was initial ...

Send an email containing the entirety of a web page

After selecting a user from a drop-down and running a search, a PHP page displays a time schedule in HTML table format. Now, the goal is to send the entire page to the user via email when a specific button is clicked. The user's email address is sto ...

Updating ng-model does not trigger a refresh in AngularJS $scope

Looking at the html snippet below <input id="zoom" name="zoom" style="width:100px" type="text" ng-model="user.zoomlvl"> Executing the code block below updates the input field above google.maps.event.addListener(map, 'zoom_changed', funct ...

The auto-complete feature is malfunctioning after retrieving input suggestions from a PHP file

My goal is to achieve the following: 1. Create a list of suggestions with same labels but different descriptions. 2. Upon selecting an item from the list, the input field of another item should change to the corresponding description of the selected item. ...

The error message "TypeError: res.response is undefined" is indicating

Currently, I am implementing user authentication using JWT auth within a Vue/Laravel single-page application. The problem arises in the register module as it fails to respond upon clicking the button. Upon inspecting the Firefox developer edition's co ...

What is the process for integrating a JOI validator with a Firebase function?

Is there a way to incorporate JOI validator into Firebase functions as middleware? When calling a Firebase function, it looks something like this: exports.createUserAccount = region("europe-east1").https.onCall(createAccount); // createAccount is ...

Pressing the button inside the iframe will cause the div to appear in the parent

I have a button in my iframe that opens a div on the same page: <li> <input type='button' id='hideshow2' class='radiobutton' value='Core' onclick="showDiv('#content2')"> </li> <di ...

Sort through an array using various prefixes and suffixes as filtering conditions

I have come across various questions and answers related to this particular issue, but most of them involve using the includes or indexOf methods. The problem at hand is how to filter an array (names in this scenario) using two different arrays - one with ...

Why isn't the Vue component refreshing its view after the state changes in Vuex?

Recently, I delved into the world of vue and learned about its redux counterpart vuex. However, I'm facing an issue where changes in the vuex state are not triggering reactive updates to the view in a vue component. export const store = new Vuex.Store ...

In internet explorer with AJAX, the UI is refreshed by Javascript only when an alert() function is triggered

Having an issue in Internet Explorer, works perfectly in Firefox. There is a javascript function that updates the UI (screen content) before an AJAX call. However, it does not update the UI unless an alert box prompt is used. Without the alert box, the UI ...

React JS does not allow TextField and Select to change

I am relatively new to full stack development and I am currently working on a project to enhance my understanding of frontend development with React JS. While working on this project, I have been using Redux without any issues so far. However, I am facing ...

Mobile Safari is having troubles loading CSS

After a long time of using in-line CSS directly on the page, I finally decided to consolidate it all into one file for my own sanity. Initially, I attempted the standard <link rel="stylesheet" href="URL"> approach and it loaded successfully, alt ...

The child divs are not adjusting to the height of the parent container

My goal is to have the height of the children div .cell fill up 100% of the parent's height, but it doesn't seem to be working. This is the HTML code: <div class="header"> header </div> <div class="wrapper"> <di ...

Exploring the possibilities: jCarousel, ASP.Net, and the power of

I've been attempting to retrieve images from the server by calling a server-side function using JQuery. The code seems to be functioning correctly without any bugs, but I'm encountering an issue where the images are not displaying. Below, I&apos ...

selenium.common.exceptions.InvalidSelectorException: Alert: A selector that is invalid or illegal has been provided

Currently, I am facing an issue with writing a script to manage web pages containing multiple elements. Upon clicking on one of these elements, it should open a new window. However, my current script is struggling to identify the element correctly. I requi ...

Attempting to update the content of a specific div element on a webpage without disrupting its current position

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>ajax div example</title> <script type="text/javascript" src="jscripts/jquery-1.6.4.min.js" ...

When I modify the CSS "display" property of an element using JavaScript, the page remains unchanged

I have a simple application designed to filter a list by displaying items that match the criteria and hiding the rest. There is a function triggered by an 'input' event on the <input> element. This function modifies the "display" attribute ...

Having difficulty selecting a cloned div using jQuery

I am in the process of creating a dynamic menu that switches out sub-menus. <nav id="main-menu"> <div id="categories"> <a id="snacks" class="categ">Snacks &amp; Sweets</a> <a id="pantry" class="categ"> ...

Do we need to duplicate structured data when listing nested objects, or is it better to avoid doing so?

We are currently focused on implementing JSON structured data for a one-page website that contains extensive information about a local business, including address, pricing, reviews, and services. The JSON snippet provided below represents the structured da ...