I have a lengthy string attached that I would like to shorten

On our website, I have encountered an error related to Client activity - "Kundenaktivität" along with a long string attached at the end. I am looking for a way to prevent the image below from showing with this lengthy string "

asdasdaxcasdasdasasdasdaxcasdasdasdasdasdasdacasascasc
". Do you have any suggestions on how I can achieve this? enter image description here This is triggered when a customer clicks inside a canvas in a new phase. The code snippet used within the phase includes:

var Cockpit = {};

Cockpit.CjmCanvas.setMapTableCjHeader = function()
{
    var canvasCjRow = $('#map-table .mm-canvas-cj');
    var headerElements = $('.map-table-header');
    headerElements.each(function() {
        var cxId = $(this).data("id");
        var curEl = canvasCjRow.find(".map-table-col-"+cxId);
        $(this).find(".map-table-cj-col").html(curEl.find(".map-table-displayfield").parent().html());
        if (curEl.find(".phase-arrows-last-element-cj").length == 0) {
            $(this).find(".map-table-menu-icon-cj").remove();
        }
        if ($(this).find('.cjmp-change-cb').length > 0) {
            var select = $(this).find('.cjmp-change-cb');
            var selOption = select.find(':selected');
            select.on("change", function() {
                if (!confirm($(this).data("confirm"))) {
                    selOption.prop("selected", "selected");
                }
            });
        }
      //I attempted to decrease the title size but couldn't locate the correct text (nesto)
        $('.cjmp-drag-element-content').on("click", function(){
            var title = $(".cjmp-drag-element-content span:last-child").text();
            var newTitle = title.substring(0, 5);
            var nesto = $(".cjmp-drag-element-content span:last-child").text(newTitle + "...");
            return nesto;
        });
        $('.mm-canvas-cj').remove();
    });
    $('#canvas-cj').parent().remove();
};
#map-table-box #map-table .map-table-header-row .corner-ca span {
    line-height: normal !important;
    max-height: 38px;
    margin: 3px 3px 3px 10px !important;
    display: inline-block;
    overflow: hidden;
}

element {
    display: inline-block;
    line-height: 110%;
    width: 135px;
    padding: 2px 4px;
    height: 27px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="cjmp-drag-element-content cjmp-choosen">
  <span class="cjm-score-value" style="background-color: #75EA00;">8.6</span>
  <span class="cjmp-content-visitors" id="cjmpc-visitors-210">0%</span>
  <span style="display: inline-block; line-height: 220%; width: 135px; padding: 2px 4px; height:27px;">testaasdfasdf </span>
</div>

These are two different css's. "Element" refers to an element described in the HTML structure, while "map-table-displayfield" represents the CSS for the display whenever someone interacts with the canvas element shown in the picture.

Answer â„–1

If you're looking to shorten text on your website, consider using a truncate technique with the max-width property and adding an ellipsis effect like shown below:

.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

UPDATE

To preserve the arrow position, you can disable the text-overflow: ellipsis and potentially place the truncated text within another element styled with the same class.

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

Glitch in transmitting server data to client in MERN stack development

I am currently developing a MERN web application and I've encountered a bug in which the data retrieved from the server is not matching what is expected when making a GET request on the client side. Below is the controller function on the server for ...

What is the correct way to specify a property for a Type within a function component? Issue TS2339 encountered

Looking at the code provided below, we can see an implementation in React that works well in JS/JSX but encounters errors when using TypeScript. import React, { useContext, useReducer, useEffect, } from 'react'; const AppContext = React.createC ...

Issue with $.ajax() functionality persists across all browsers except for Firefox

Whenever the page loads, a small script I have retrieves rental dates. Additionally, if the user selects a different month from the drop down, new dates are also fetched. Unfortunately, the site is using jQuery 1.2.3 and I'm unable to update to 1.4 d ...

How to include THREE.js in a Node module along with custom variables and functions

I have been working on adapting a THREE.js project that originally included JavaScript files directly in HTML into a node module-based setup. My goal is to utilize webpack to bundle the project into a single file (bundle.js) so that the HTML only needs to ...

Exploring JSON data with AJAX

After successfully capturing the value and event for searching inside a json file, I encountered an unexpected issue during iteration. How can I properly select an object based on this search query? The problem arises when using .each method to loop throug ...

Is there a way to only apply styles to the specific element I am hovering over in CSS and not affect the entire list hierarchy?

I am trying to display an "Icon" when hovering over each item individually. The issue I am facing is that when I hover over a child item, the parent item also displays its icon. .list { width: 150px; height: 19px; } .list >.item { background-co ...

What is the function of '@' symbol in coding?... obtain {ModuleName} from '@ModuleName'

What is the significance of the '@' symbol in imports? I've noticed that various modules like '@react-navigation', '@babel', and others use the '@' symbol. Does this symbol serve a specific purpose, or is it s ...

Tips for validating the values in a multi-value dictionary against each key in node.js?

I have a dictionary with multiple values and I need to check if any of those values are equal to the respective URL while iterating through the loop. console.log("Hello World") const dns =require('dns') //Verifying the status of the URL fun ...

Serialize jQuery value to PHP code

I am relatively new to the world of incorporating jQuery with PHP. Recently, I experimented with the nestedsortable plugin from jQuery and managed to successfully integrate it into my kohana 2.3.4 framework. However, I am now faced with the challenge of tr ...

Is it possible for Angular to perform bidirectional data binding in reverse between two input fields?

I'm struggling to get my two input fields to update values when the opposite input is changed. My goal is to create a simple $dollar to Gold oz calculator with two input fields. You can see a sample preview here: http://embed.plnkr.co/dw6xL95zRqJC1p ...

Leveraging the power of WordPress Rest API alongside AngularJS ui-sref and customized HTML

Currently, I am working on setting up an AngularJS application that retrieves content from a Wordpress back-end using the wp-rest api v2. Everything seems to be functioning smoothly, however, I have noticed that certain HTML attributes are being removed. ...

Extract core object from array of objects with lodash or javascript

In my code, I have an array of objects that each contain a base object with a set of values. My goal is to remove the base object from all the data and achieve the Expected result shown below. Here is an example of the array: [ { "100": { ...

Switching iframe content based on screen size

I'm attempting to use jQuery to dynamically change the source, width, and height of an iframe based on the viewport width. Here is the code I currently have: <head> <script type="text/javascript"> $(document).ready(function() ...

Incorporating external API information into Google Maps

My current challenge involves creating a polygon on Google Maps using data obtained from an external API found at . Upon analyzing the API response, the following information is provided: { "id": 28, "name": "Local spots", "description": "", "isprivate": ...

Make sure to query MySQL database to see if the data already exists, and if not, go ahead and insert it using PHP

I am encountering difficulties in writing PHP code to insert values into a MySQL database only if they do not already exist. I am transmitting an array from JavaScript to a PHP file using $.ajax with the POST method. Do I need to include an additional &a ...

The issue arises when using IE8/9 with $.get and .html() functions, as the retrieved data

Below is a snippet of JavaScript code that I am currently working with: $(".refresh").on("click touch", function () { $.get($("a.suggest-date").attr('href') + '#suggestedDate', null, function (result) { console.log(result); ...

Posting PHP Data Once Ajax Retrieves Response

Why is a POST variable from my form always empty? Here's the code snippet that might be causing the issue: I have a dropdown (select) in Bootstrap that displays information upon selecting an item. Code: $(function() { $("#shiftsDD").change(fun ...

Steps to populate an array in a mongoose schema post creation:

I am faced with the challenge of working with two different schemas: var UserSchema = new Schema({ provider: String, username: String, ... categories: [{type: Schema.Types.ObjectId, ref: 'Category'}], ... }); export default mongoose.m ...

Position the button at the bottom of the card using Bootstrap

While exploring a Bootstrap example utilizing the card-deck and card classes (Pricing example), I pondered over how to align buttons correctly when one list has fewer items than others. https://i.sstatic.net/IGN7K.png I aim to vertically align all button ...

Can Handsontable be vulnerable to XSS without the use of PHP?

Despite my webpage having the php extension, there is actually no php code present on it. Instead, users are able to input numbers and experience some exciting JS effects through the integration of handsontable. While developing the comments section, I i ...