Home > Web Front-end > JS Tutorial > JavaScript carriage return perfectly implements tab switching function_javascript skills

JavaScript carriage return perfectly implements tab switching function_javascript skills

WBOY
Release: 2016-05-16 16:55:47
Original
1087 people have browsed it

One of my recent projects was for a chemical plant, which required a large amount of data to be entered during the process. The small keyboard area was used. In the past, data was entered through excel. Now,

is on the web page. I need to implement the carriage return and line feed function like Excel. I looked for questions about this on the Internet, but they are not very easy to use. Some people also provided ideas on how to do it.

After my sorting and testing , can solve this problem very well:

Required conditions

1. For the Jquery library address, you can go to the jquery.com official website to download the latest one.

2. View the interface form The structure and corresponding form position

The following are some form structures

Copy code The code is as follows:


Login form


  1. Username




  2. < asp:Label runat="server" AssociatedControlID="UserName">Username

    < asp:RequiredFieldValidator runat="server" ControlToValidate="UserName" CssClass="field-validation-error" ErrorMessage="The username field is a required field." />

  3. < li>
    Username




  4. username




  5. username




  6. username




  7. username




  8. username




  9. username




  10. Password





  11. Remember me?





Pay attention to the context tag relationship that needs to be positioned in the form
http://images.cnitblog.com/i/461877/201403/131104380377939.jpg
After generating the page, no matter where the punctuation element is, but there is After the label element with unchanged structure, we need to switch to the form element and type="text"

Then use Jquery's selector level selector prev next positioning. If you don't know much about it, you can check the jquery help document. It doesn’t matter what method you use as long as you can locate the element you want to select

Here’s the key script code:
Copy code The code is as follows:

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template