Chaos ensues as the HTML contenteditable attribute disrupts the expected structure of the table

Whenever I attempt to click on the edit button to make changes to the content of the Email column, the HTML table structure begins to change in a strange manner.

Here is the code snippet causing the issue:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
</head>
<script>
function deleteAction(){
$("#fname").attr('contenteditable','true');
$("#lname").attr('contenteditable','true');
$("#email").attr('contenteditable','true');
}
</script>
<body>
<div class="container">>            
  <table class="table table-bordered">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
<th>Delete</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="fname">John</td>
        <td id="lname">Doe</td>
        <td id="email"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f79d989f99b7928f969a879b92d994989a">[email protected]</a></td>
<td><button class="btn btn-danger" id="delete" onclick="deleteAction()">Delete</button></td>
      </tr>
    </tbody>
  </table>
</div>

</body>
</html>

This particular code snippet functions correctly when run using SO inline code snippet runner. However, as shown in the image below, the same code behaves differently.

https://i.sstatic.net/msUCD.png

Is there anyone who can resolve this issue? Please help me identify where I may be making mistakes.

Answer №1

Upon thorough investigation and troubleshooting, it has been identified that the issue is being triggered by the Grammarly extension installed in my chrome browser. Once this extension was disabled, the functionality returned to normal.

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

When incorporating a URL slug to Next.js routing, an error of "TypeError: path should be type string, getting type

I have been attempting to include an :id slug in the URL for a blog post within my next.js application. Everything functions properly when I navigate from the app to the page; however, if I refresh the page on the post or directly access the page, I encoun ...

Adjust the background color of the dropdown menu

I'm struggling to change the background color of the property address picker dropdown from transparent to white. I've been trying different things but can't seem to get it right. Any suggestions? Additionally, I want to change the cursor to ...

eliminate several digits past the decimal place

I thought this would be a simple task, but I'm completely stuck with the code I currently have! https://i.sstatic.net/Y36Cg.png render: (num) => { return <span><b>{num.toFixed(2)}</b>%</span>; // rounding to two de ...

The jQuery function $.post fails to include information about which button was clicked in the request

I've encountered a problem where $.post isn't sending information about which button was pressed in my form. The scenario is having a form with two buttons: <form method="post" action="/home/index"> <input type='hidden' n ...

Is there a way to make a string evaluate inline using JavaScript and React?

In my function, the following code works perfectly: console.log(theme.colors.blues[1]); To make the last part dynamic, I tried the following approach: const getColor = (theme, passedColorProp) => { console.log(theme.colors.[passedColorProp]); }; g ...

Create a randomly generated value in a JSON format

{ "description": "AppName", "name": "appName", "partnerProfile": { "email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f19090b1969c90989ddf929e9c">[email protected]</a>", "firstName": "John", ...

The problem encountered with the Enzyme mount API is a TypeError where it is unable to read the property 'find' of an undefined variable

After converting my component to a stateless one, I started encountering an error that says: TypeError: Cannot read property 'find' of undefined Previously, my tests were running smoothly before the switch. As far as I know, you can test functio ...

Create interactive highcharts graphs using data from a CSV file generated through PHP

I'm having trouble working with Highcharts and csv data. Take a look at this example: http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-ajax/ $.getJSON('http://www.highcharts.com/ ...

Transforming a React object into an array and displaying it on the frontend using the .map method

After making a single API call, I have received two different sets of data. The first set is an array containing information about various items, including their names, prices, rarity, and images. The second set consists of items with details such as condi ...

Strange behavior of dropdown submenu

I've encountered an issue where my child's ul li elements are not behaving as expected, despite following advice from other sources. After days of debugging with no success, I am unable to pinpoint the problem. The image showcases the issue perfe ...

Issue with jQuery click event not firing on multiple buttons with identical names

These are the two buttons that appear multiple times but do not function: <button name='btnEditar' class='btn btn-outline-success me-4' data-bs-toggle='modal' data-bs-target='#staticBackdrop'><i class=&a ...

Can Webmatrix implement CRUD operations on the same page with Ajax?

Can anyone suggest the quickest and most secure method for performing CRUD operations (Update, Edit, Insert) on the same page using Ajax in WebMatrix Razor Syntax? Is it feasible to achieve these CRUD operations on the same razor page with ajax without rel ...

What could be the reason for the inability to install Angular JS 2?

Setting up Angular 2 for experimentation on my VPS has been quite a challenge. The initial steps can be found here. Upon trying the first command: $ npm install -g tsd@^0.6.0 I encountered success. However, the second step led to an error: tsd install ...

Display a hyperlink in an iframe on the main page from a different domain using JavaScript

I'm currently using Angular with Wirecard as my payment provider. When I need to add a payment, I open an iframe that directs the user to the Wirecard site to accept the payment. Once the user clicks accept, I provide a link back to my site from Wirec ...

Hovering over an image will not cause the floating header to appear

My attempt to create a header that fades with scroll and appears on hover is working perfectly, except for the cat pictures in the Portfolio section. Despite adjusting z-indexes and trying various solutions, the header just won't show up over the h4 e ...

Editing an XML file on the browser and saving it in its original location on the local file system

Seeking assistance with editing an XML file directly from the browser on a local file system and saving it back to its original location. I have conducted extensive research using Google, but have not been able to find a suitable solution. Any help or gu ...

Can someone provide guidance on how to validate a HEX color in Cypress?

As I dive into testing with Cypress, my lack of experience has become apparent. I am trying to test the background-color CSS property on a specific element, but running into an issue - everything is in RGB format behind the scenes, while I need to work wit ...

utilizing an ajax request to clear the contents of the div

When I click on Link1 Button, I want to use ajax to empty the contents in the products_list div <button type="w3-button">Link1</button> I need help with creating an ajax call that will clear the products in the product_list when the link1 but ...

Refreshing data attribute following an ajax request

I have this page with a list of various job listings. Each job listing has a button labeled "Paid" that includes a data-paid attribute indicating whether the job is paid or not. Whenever the "Paid" button is clicked, it sends a request to my route which u ...

Create compelling visual representations by utilizing Google charts to draw customized charts based on variable

I have been attempting to create a chart using Google Charts by passing some parameters to the function. I am trying to use these parameters to populate the data, but it doesn't seem to be working as expected. Is it possible to include parameters in t ...