Web radio button Pass-value problem __web

Source: Internet
Author: User

Radio Button Code:

<input type= "hidden" name= "Quest1" "id=" Quest1 "value=" "> <input name=" Fruit "type=
" Radio "value=" 1 "/> Apple
<input name= "Fruit" type= "Radio" value= "2"/> Peach <input
name= "Fruit" type= "Radio" value= "3"/> Banana
<input name= "Fruit" type= "Radio" value= "4"/> Pear <

The first hidden input is used to save the data you choose

Input value changes to use JS to control, I am here with jquery, you can download a, JS code as follows

<script>
$ (' input[type=radio] '). Change (the function () {
	var m = $ (this). Val ();//Gets the value
	$ ("#quest1") that is selected. Val (m);//Save value to Questi control
})
</script>

The server gets the foreground data code:

String a=req.getparameter ("Quest1");
So, depending on the value of a, you know which one you chose.

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.