jquery function application and form validation processing encountered in development

Source: Internet
Author: User

Finishing the front-end JS notes the first article!

Form form Submission

$ (". Submit"). Removeattr. (' onclick '); $ (' [name= ' form table sole name "]"). Submit;

Gets the ID of input

$ (' #id '). Val ();

Get the name of input

$ (' [name= ' name value '] '). Val ();

Each method matches the function specified by the element for each element

$ ("Li"). each (function ()) {}//For Li label matching this method

The Attr method returns the value of the property that sets the selected element

$ ("img"). attr ("width", "180");

The checkbox represents the HTML selection box


To perform a delete for the INPUT element matching method

var flag = 0;$ (' input:checkbox[name= "id[]"]:checked "). each (function (i) {flag = 1;});   if (flag = = 0) {alert (' Please select the data to be deleted '); return false;} Gets the form form execution method $ ("Form[name= ' OrderForm ')"). attr (' action ', ' {URL: The address of the Delete method} '); Confirm (' Are you sure you want to delete the selected data? ', ' Formsubmit (\ ' orderform\ ');

Json::encode converting an array to JSON data

JSON ($array) converts an array to a string



jquery function application and form validation processing encountered in development

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.