When clicked, the secondary column will shift, and the three dots should not appear as bullets

Is there a way to remove the bullet points representing three dots in my list without hiding them? Hiding the bullet would create a gap in my bulleted list when expanding with a "show more" button, causing an uneven appearance. I am not proficient in Javascript, so I am unsure of how to address this issue.

 <head>
<script> 
    function myFunction() {
     var dots = document.getElementById("dots");
    var btnText = document.getElementById("myBtn");
    var more = document.querySelectorAll(".more");

    if (dots.style.display === "none") {
    more.forEach(el => el.classList.add("hidden"));
    dots.style.display = "inline";
    btnText.innerHTML = "Read more";
    } else {
    more.forEach(el => el.classList.remove("hidden"));
    dots.style.display = "none";
    btnText.innerHTML = "Read less";
    }
    }
    </script>
    <style>
    #more {
      display: none;
    }

    .columns {
    columns: 2;
    -webkit-columns: 2;
    -moz-columns: 2;
    position: relative;
    }

    .hed {
    font-size: 16px;
    font-weight: 800;
    list-style: none;
    margin: 15px 0px 5px;
    }

    .hidden {
    display: none;
    }

    table.map-list td{
width:50% !important;
vertical-align: top !important;
}

    </style>

</head>

    <body>

    <table class="map-list" width="100%" border="0">
    <tbody>
      <tr>
        <td>
          <h4>Elementary</h4>
          <ul>
            <li>Maps: Primary: ELS</li>
            <li>Maps: Primary: Readiness</li>
            <li><span id="dots">...</span></li>
            <li class="more hidden">U.S. History:8 Revolutionary War</li>
          </ul>
        </td>

        <td>
          <h4>Secondary</h4>
          <ul>
            <li>Maps: Intermediate: Physical</li>
            <li>Maps: Intermediate: Political</li>
            <li class="more hidden">Maps: Secondary: Population Thematic</li>
          </ul>
        </td>
      </tr>
    </tbody>
    </table>
    <button onclick="myFunction()" id="myBtn">Read more</button>
    </body>

Answer №1

To resolve the issue, simply eliminate the parent <li> element surrounding the dots span.

<span id="dots">...</span>

Live Example:

<head>
<script> 
    function myFunction() {
     var dots = document.getElementById("dots");
    var btnText = document.getElementById("myBtn");
    var more = document.querySelectorAll(".more");

    if (dots.style.display === "none") {
    more.forEach(el => el.classList.add("hidden"));
    dots.style.display = "inline";
    btnText.innerHTML = "Read more";
    } else {
    more.forEach(el => el.classList.remove("hidden"));
    dots.style.display = "none";
    btnText.innerHTML = "Read less";
    }
    }
    </script>
    <style>
    #more {
      display: none;
    }

    .columns {
    columns: 2;
    -webkit-columns: 2;
    -moz-columns: 2;
    position: relative;
    }

    .hed {
    font-size: 16px;
    font-weight: 800;
    list-style: none;
    margin: 15px 0px 5px;
    }

    .hidden {
    display: none;
    }

    table.map-list td{
width:50% !important;
vertical-align: top !important;
}

    </style>

</head>

    <body>

    <table class="map-list" width="100%" border="0">
    <tbody>
      <tr>
        <td>
          <h4>Elementary</h4>
          <ul>
            <li>Maps: Primary: ELS</li>
            <li>Maps: Primary: Readiness</li>
            <span id="dots">...</span>
            <li class="more hidden">U.S. History:8 Revolutionary 
    War</li>
          </ul>
        </td>

        <td>
          <h4>Secondary</h4>
          <ul>
            <li>Maps: Intermediate: Physical</li>
            <li>Maps: Intermediate: Political</li>
            <li class="more hidden">Maps: Secondary: Population 
    Thematic</li>

          </ul>
        </td>
      </tr>
    </tbody>
    </table>
    <button onclick="myFunction()" id="myBtn">Read more</button>
    </body>

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

What is the best way to arrange multiple elements on the second row within a div?

As I attempt to utilize CSS for positioning elements within a div, my challenge lies in the limitation of only being able to use classes/ids due to the fact that the div and its content are generated from a third-party plug-in (datatables). This restricts ...

Tips on customizing autocomplete to display results fetched via ajax

I created a basic text box for users to input information. Using AJAX, I send this information to a PHP script to retrieve results. The results are then displayed in a DIV beneath the input box. However, I am struggling to update the autocomplete suggestio ...

What is the best way to submit complex form data as an array or object?

I am consolidating passenger information by using input names in this format: passenger[1][name] passenger[1][surname] passenger[1][idnumber] passenger[2][name] passenger[2][surname] passenger[2][idnumber] However, when I submit the data in this way, the ...

How to retrieve the ID of a child element using jQuery

Apologies for the confusion, I realize my question may not have been clear enough. Some of the g elements within the div actually consist of groups of svg elements. You can take a look at an example in this JSFiddle link. These groupings allow for incorpor ...

Executing a javascript function using ajax

My current setup involves using a multiselect dropdown to filter images stored in a database. The issue arises when the filtered results are paginated, as the pagination seems to fail. The filter triggers an Ajax call to a PHP script in order to retrieve t ...

How to add new data to a JSON file with JavaScript

Currently, I am developing a discord bot that extracts responses from a JSON file. The structure of the JSON file is basic and looks like this: "matt": { "insults" : ["test 1", "test 2", "test 3", "test 4" ...

Creating MongoDB queries on-the-fly in a NodeJS environment

Upon receiving a POST argument structured as follows: sort: [ { field: 'name', dir: 'asc', compare: '' }, { field: 'org', dir: 'asc', compare: '' } ] } It is necessary ...

Ways to stop bootstrap tabs from ruining inactive content? [keeping track of tab status]

Although Bootstrap tabs are useful, a common issue is that content on inactive tabs is removed from the page flow. When switching to a new tab, the previous tab's display attribute is set to none instead of using visibility: hidden or other methods. ...

Error: The listen function in React + Redux Simple Router is undefined and cannot be found

I've been attempting to configure react + react-router + redux + redux-simple-router without success. I encounter an issue when adding redux-simple-router, resulting in the error message: "[TypeError: Cannot read property 'listen' of undefi ...

Unraveling the Mystery of jQuery Syntax

Upon reviewing jquery.ui-1.8.11.js: $.extend(Datepicker.prototype, { /* A unique class name appended to elements indicating they are configured with a date picker. */ markerClassName: 'hasDatepicker', /* For debugging purposes (if e ...

A step-by-step guide on troubleshooting and resolving issues with "ng build"

Need help resolving the ng build project issue in Angular without modifying angular.json. Encountered the following error: Your global Angular CLI version (8.3.16) is higher than your local version (8.1.3). The local Angular CLI version will be used. To ...

Ways to extract the value from a jQuery object

How can I retrieve the selected time value using a jQuery plugin and save it on a specific input element within the page? Refer to the plugin and code provided below: http://jsfiddle.net/weareoutman/YkvK9/ var input = $('#input-a'); input.cloc ...

As you minimize the browser window, you may notice a white space appearing when scrolling over

Encountering an issue with my webpage where, upon minimizing the browser horizontally and causing overflow, scrolling over to view the hidden section results in a blank page. Any idea why this is happening? I have set my divs to a specific height (e.g. 9 ...

Issue with React-select: custom Control prevents select components from rendering

Implementing react-select@next and referring to the guide here for custom Control components is not yielding the desired outcome. import TextField from "@material-ui/core/TextField"; import Select from "react-select"; const InputComponent = (props) => ...

retrieving data from the database table

I'm having trouble retrieving specific values from a table. No matter what input I provide, I always get results from both rows. I want to match the input ID with the ID in the table. The code I'm attempting to use can be found in the attached im ...

Querying subdocuments within an array using MongoDB's aggregation framework

Currently, I'm facing a challenge while developing a statistics dashboard for a meditation app. I'm struggling with creating a MongoDB query to fetch the most popular meditations based on user progress. The key collections involved are users and ...

In Firefox mobile, a fixed positioned element will move with the page until the scrolling comes to a halt

I am facing an issue with a CSS element set to position: fixed. While it works perfectly on desktop browsers, it behaves poorly on mobile browsers, especially Firefox. The main problem is that the fixed element scrolls along with the page and then abrupt ...

"Enhance your List by Adding Values with the Power of

How can I use JQuery append to push list values to another div section when a button is clicked? For instance: I have two list values 1.Adam 2.Lance When the add button is clicked, Adam's value should be added to another div section, and the s ...

transforming blog into a data URL

I've been struggling to convert an image blob into a data URL using Vue.js, but I keep encountering this error: 'Error in v-on handler: "TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provide ...

Enabling sidebar functionality for every component in React JS using React Router v6

I am currently using react router dom v6 and encountering an issue where the sidebar disappears whenever I click on any component in the app. I need to find a way to keep the sidebar visible across all components. Sidebar Available https://i.sstatic.net/ ...