Idiot question-check for js verification.

Source: Internet
Author: User
Idiot question-check the js verification. dear friends, my code is like this:


I want to add a js check for this check. if one is not selected, it will stay on the original page and issue a warning. If yes, it will jump to reponse. php. I tried a lot of js codes on the Internet, but none of them were successful. how do you write this js code?


Reply to discussion (solution)

I wrote it casually, but I haven't verified it. the general idea is this.

$ ("Input [name = 'submit ']"). click (function () {if ($ ("input [name = 'activite [] ']"). attr ("checked") = false) {alert ('select at least one '');} else {location. herf = "reponse. php ";}});

When the check fails, you need to return false to prevent the page from redirecting. Otherwise, the page will jump even though the check is out. So after the code that prompts the warning, follow a return false;
The code will not be written. I haven't written PHP for a long time. forget it, huh, huh.

Script function func (obj) {var boxs = obj. elements ['activite [] ']; var counter = 0; for (var I = 0; I

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.