Home Web Front-end JS Tutorial Use jQuery to implement double-click table editing function

Use jQuery to implement double-click table editing function

Jun 29, 2017 am 10:39 AM
jquery double click edit

This article introduces you to everyone through example codejquery Double-click to editForm, friends who need it can refer to it

First I will show you the rendering:

The following is a simple form editing function implemented in a simple way:

The simple HTML code is skipped, the following is the js implementation process

JavaScript:

<span style="font-size:18px;">$(".tables").on("dblclick","td",function(){ 
 if($(this).children("input").length>0){ 
  return false; 
 } 
 var tdDom = $(this); 
 //保存初始值 
 var tdPreText = $(this).text(); 
 //给td设置宽度和给input设置宽度并赋值 
 $(this).width(100).html("<input type=&#39;text&#39;>").find("input").width(100).val(tdPreText); 
 //失去焦点的时候重新赋值 
 var inputDom = $(this).find("input"); 
 inputDom.blur(function(){ 
  var newText = $(this).val(); 
  $(this).remove(); 
  tdDom.text(newText); 
 });</span>
Copy after login

The above is the detailed content of Use jQuery to implement double-click table editing function. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to edit documents in Tencent Docs? -Tencent Document Editing Document Tutorial Guide How to edit documents in Tencent Docs? -Tencent Document Editing Document Tutorial Guide Mar 19, 2024 am 08:19 AM

Does anyone know how to edit documents in Tencent Docs? It doesn't matter if you don't know. Today, the editor will introduce detailed graphic explanations on how to edit documents in Tencent Docs. I hope it can help you. Detailed graphic explanation of editing documents in Tencent Documents 1. First, enter Tencent Documents directly (if you don’t have it, download it now!) and log in directly (QQ and TIM two login methods are supported) 2. After logging in, click Add in the upper right corner No., directly create online documents, online forms, new folders, etc.! 3. Then enter the information according to your needs!

What to do if word document cannot be edited What to do if word document cannot be edited Mar 19, 2024 pm 09:37 PM

After editing the document, we will save the document to provide convenience for editing and modifying the document next time. Sometimes we can modify it directly after clicking on the edited document, but sometimes for some unknown reason, there is no response no matter how we click on the word document, and the command will not be executed. , what should I do if the word document cannot be edited? Don’t worry, the editor will help you solve this problem. Let’s take a look at the operation process. After opening a Word document, when editing text, you will see a &quot;Restrict Editing&quot; prompt displayed on the right side of the page, as shown in the figure below. 2. You need to cancel editing and you need to know the set password. Click &quot;Stop Protection&quot; below the pop-up prompt, as shown in the figure below. 3. Then enter the password in the &quot;Unprotect Document&quot; dialog box and click OK, as shown in the figure below.

How to set up double-click lock screen on Meizu 21pro? How to set up double-click lock screen on Meizu 21pro? Mar 18, 2024 pm 04:10 PM

Meizu 21Pro's operating system Flyme also provides a wealth of personalization options, allowing users to customize according to their own preferences and habits. Among them, the double-click lock screen function is a very practical setting that allows users to quickly lock the screen and protect the security of the phone. Next, we will introduce how to set up the double-click lock screen function on Meizu 21Pro to make your phone more convenient to use. How to set double-click lock screen on Meizu 21pro 1. Enter [Settings]-[Accessibility]-[Gesture Wake], click the switch on the right side of [Gesture Wake] to control the black screen gesture function on or off. 2. On the system desktop-Settings-Fingerprint and Security, set the lock screen password or enter the fingerprint. If there is no fingerprint unlock function, go to Settings-Security.

How to open exe format files in win10? What should I do if double-clicking fails?_How to open exe format files in win10 How to open exe format files in win10? What should I do if double-clicking fails?_How to open exe format files in win10 Mar 27, 2024 pm 05:00 PM

1. First we need to make some settings, and then try to double-click to open. Right-click the Start menu and select [Command Prompt (Administrator)] to open it. 2. Open the administrator command prompt interface and enter assoc.exe=exefile, as shown in the figure. 3. Press Enter, exe=exefile appears, as shown in the figure. 4. Now the file with the suffix name exe can be opened by double-clicking the mouse. 5. If that still doesn't work, you can use anti-virus software to scan the computer to rule out whether it is caused by a virus.

How to use PUT request method in jQuery? How to use PUT request method in jQuery? Feb 28, 2024 pm 03:12 PM

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

How to remove the height attribute of an element with jQuery? How to remove the height attribute of an element with jQuery? Feb 28, 2024 am 08:39 AM

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

The specific method of editing vertical subtitles in Edius The specific method of editing vertical subtitles in Edius Mar 28, 2024 pm 02:52 PM

1. Make preparations. Import a piece of material into the material library and drag it to the timeline. 2. Click the [T] button on the timeline track, choose to add subtitles on the 1T track, and you will enter the subtitle editing page. The operation is as shown in the picture: 3. Here you can write the text content we want. It is obvious that the subtitles are written horizontally. Now let’s take a look at how to implement vertical subtitles. Don't write the content yet, select [Insert - Text - Vertical] as shown in the picture: 4. Now write the words and it will be arranged vertically. After adjusting the position, size, font, color and other information of the subtitles, click Save in the upper left corner of the window.

How to solve the problem of double-clicking an EXE file that cannot be opened in WIN10 system How to solve the problem of double-clicking an EXE file that cannot be opened in WIN10 system Mar 28, 2024 pm 01:26 PM

1. Right-click the Start menu and open Command Prompt (Administrator). 2. After opening the command prompt window, enter the assoc.exe=exefile command and press Enter. 3. At this time, .exe=exefile appears, indicating that the association is successful. Finally, double-click the application to open it smoothly.

See all articles