Use jquery to make text boxes and modify them when you click Text

Source: Internet
Author: User

1$(function() {2 //gets the element that is class CAName3$ (". CAName"). Click (function() {4 varTD = $ ( This);5 varTXT =Td.text ();6 varInput = $ ("<input type= ' text ' value= '" + txt + "'/>");7 td.html (input);8Input.click (function() {return false; });9 //Get FocusTenInput.trigger ("Focus"); One //The text box loses focus, commits the content, and becomes text again AInput.blur (function() { - varNewtxt = $ ( This). Val (); - //determine if the text has been modified the if(Newtxt! =txt) { - td.html (newtxt); - /* - * This section of the database does not need to be used + var caid = $.trim (Td.prev (). text ()); - //ajax Changing the database asynchronously, parameter date is the resolution of the cache problem + var url = ".. /common/handler2.ashx?caname= "+ newtxt +" &caid= "+ CAID +" &date= "+ new Date (); A //Use the Get () method to open a generic handler that data accepts the returned parameter (the method that returns the parameter in the generic handler context. Response.Write ("Parameters to return");) at //Database modification is done in a generic handler - $.get (URL, function (data) { - if (data== "1") - { - alert ("The category already exists!") "); - td.html (TXT); in return; - } to alert (data); + td.html (newtxt); - }); the */ * } $ ElsePanax Notoginseng { - td.html (newtxt); the } + }); A }); the});

Use jquery to make text boxes and modify them when you click Text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.