


Click the button text to become an input box, click save to become text implementation
The following will bring you an implementation code for clicking the button text to turn it into an input box, and clicking save to turn it into text. The content is quite good. I would like to share it with you now and give it as a reference.
Click the button text to become the input box, click save to become the text implementation code
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta charset="utf-8"> <title>点击按钮文字变成input框,点击保存变成文字</title> <style type="text/css"> table{ text-align: center; font-size: 14px;} table>thead>tr>th{ font-weight: normal;} .text-right{ padding-right:73px; text-align: right;} .text{ width: 50px; height: 30px; border: 1px solid #ddd; text-align: center;} </style> <script type="text/javascript" src="js/jquery.min.js"></script> </head> <body> <table> <thead> <tr> <th width="400">品名</th> <th width="200">件数</th> </tr> </thead> <tbody> <tr height="50"> <td>iPhone6s</td> <td class="edit">2</td> </tr> <tr height="50"> <td>小米5</td> <td class="edit">5</td> </tr> </tbody> <tfoot> <tr> <td colspan="2" class="text-right"> <button type="button" class="btn" onclick="change(this)">修改</button> </td> </tr> </tfoot> </table> <script type="text/javascript"> function change(obj){ var xg=$(obj).html(); if(xg=='修改'){ $('.edit').each(function(){ var old=$(this).html(); $(this).html("<input type='text' name='editname' class='text' value="+old+" >"); }) $(obj).html('保存'); }else if(xg=='保存'){ $('input[name=editname]').each(function(){ var old=$(this).html(); var newfont=$(this).parent('td').parent('tr').children().find('input').val(); $(this).parent('td').html(newfont); }) $(obj).html('修改'); } } </script> </body> </html>
The above is this article The entire content, I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
Introduction to mobile web screen adaptation (rem)
How to use HTML in two Draw a vertical line in the middle of each div tag
The above is the detailed content of Click the button text to become an input box, click save to become text implementation. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Restart Microsoft Teams If you get a blank screen after launching Teams, a good place to start is to restart the app itself. To close and restart Microsoft Teams: Right-click the Teams icon in the notification area of the taskbar and click Exit from the menu. Restart Microsoft Teams from the Start menu or desktop shortcut and see if it works. Close Microsoft Teams from Task Manager If a basic restart of the Teams process doesn't work, go into Task Manager and end the task. To close Teams from Task Manager, do the following

What is the Windows Security Button? As the name suggests, Windows Security Button is a security feature that allows you to securely access the login menu and log in to your device using a password. In this case, smartphones are definitely ahead. But Windows portable devices, such as tablets, have begun adding a Windows Security button that's more than just a way to keep unwanted users out. It also provides additional login menu options. Although if you try to find the Windows Security button on your desktop PC or laptop, you might be disappointed. why is that? Tablets vs. PCs The Windows security button is a physical button that exists on tablets

There are many reasons why you might want to disable the Delivery Optimization service on your Windows computer. However, our readers complained about not knowing the correct steps to follow. This guide discusses how to disable the Delivery Optimization service in a few steps. To learn more about services, you may want to check out our How to open services.msc guide for more information. What does Delivery Optimization Service do? Delivery Optimization Service is an HTTP downloader with cloud hosting solution. It allows Windows devices to download Windows updates, upgrades, applications and other large package files from alternative sources. Additionally, it helps reduce bandwidth consumption by allowing multiple devices in a deployment to download these packages. In addition, Windo

First, draw a circle in PPT, then insert a text box and enter text content. Finally, set the fill and outline of the text box to None to complete the production of circular pictures and text.

How to Force Restart iPad Mini 6 Force restarting iPad Mini 6 is done with a series of button presses, and it works like this: Press and release for Volume Up Press and release for Volume Down Press and release the Power/Lock button until you see Apple logo, indicating that the iPad Mini has been force restarted. That’s it. You have force restarted the iPad Mini 6! Force restart is usually used for troubleshooting reasons, such as the iPad Mini freezing, apps freezing, or some other general misbehavior. One thing to note about the procedure for force restarting the 6th generation iPad Mini is that for all other devices that have ultra-thin bezels and use

<h3>What should I know about connecting my PS5 controller? </h3><p>As good as the DualSense controller is, there have been reports of the controller not connecting or not being detected. The easiest way to solve this problem is to connect the controller to your PC using an appropriate USB cable. </p><p>Some games natively support DualSense. In these cases, you can simply plug in the controller. But this raises other questions, like what if you don't have a USB cable or don't want to use one

When we create Word documents on a daily basis, we sometimes need to add dots under certain words in the document, especially when there are test questions. To highlight this part of the content, the editor will share with you the tips on how to add dots to text in Word. I hope it can help you. 1. Open a blank word document. 2. For example, add dots under the words "How to add dots to text". 3. We first select the words "How to add dots to text" with the left mouse button. Note that if you want to add dots to that word in the future, you must first use the left button of the mouse to select which word. Today we are adding dots to these words, so we have chosen several words. Select these words, right-click, and click Font in the pop-up function box. 4. Then something like this will appear

<ul><li><strong>Click to enter:</strong>ChatGPT tool plug-in navigation</li></ul><h2>Find and delete download history in Edge< /h2><p>Like other browsers, Edge has a<strong>Download
