jquery checkbox checkbox realizes _jquery before deleting

Source: Internet
Author: User
To achieve such a basic requirement, the page has a lot of data, you can delete one or more, before the deletion of the judge whether to select at least one, otherwise prompted.
Copy Code code as follows:

function DeleteUser () {
I was trying to save the content in a str+= "" way, but no.
var str;
var array = new Array (); The ID used to save the selected piece of data
VAR flag; Determine whether an option is not selected
$ ("Input[name= ' Selectflag ']:checkbox"). each (function () {//Traverse all checkbox with Name Selectflag
if ($ (this). attr ("checked")) {//Determine if selected
Flag = true; As long as there is one selected set to True
}
})
if (flag) {
$ ("Input[name= ' Selectflag ']:checkbox"). each (function () {//Traverse all checkbox with Name Selectflag
if ($ (this). attr ("checked")) {//Determine if selected
Alert ($ (this). Val ());
Array.push ($ (this). Val ()); Add the selected value to the array
str+=$ (This). Val () + ",";
}
})
Data that will be deleted collectively is passed to action
Window.self.location = "deleteuser?info=" + array;
} else {
Alert ("Please select at least one user");
}
}

Background action to receive data for deletion
Copy Code code as follows:

@Override
Public String execute () throws Exception {
//TODO auto- Generated method stub
//foreground is the first decomposition string transmitted in A,B,C format
string s[] = Info.split (",");
/*
* for (int i=0;i<s.length;i++) {System.out.println (s[i]);}
/
if (s.length > 0) {
for (int i = 0; i < s.length; i++) {
Userdao.deleteuser (s[i));
}

Return "Success";
}

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.