简体   繁体   中英

How to pass list of values into a radio button selection

I have a Student bean which is iterated to display the mark reports of students in a table.Each row in a table is provided with a radio button selection followed by viewing the report on onclick event.

I am passing the value of the student id by setting it in the radio button and subject in a hidden input field

<input type="radio" name="studentList.id" value="TE3"/>
<input type="hidden" name="studentList.subject" value="Mathematics"/> 

These two parameters are needed for retrieving the report based on subject and student id.

But I can't pass these parameters as they should be .

What am I doing wrong? Any suggestions or ways to attain the requisite ?

Thanks for your time .

JSFIDDLE : http://jsfiddle.net/jaggs/f8su70mc/

first you check radio button ckecked or not if ($("#radio1").is(":checked")) { // do something }

use is parameter in radio button field

for getting values:-- $('input[name="studentList.subject"]').val();

i hope it help you

Maybe something along the lines of...

$('input[name="studentList.subject"]').val();

This would return the any input the value, where its attr of name = "studentList.subject".

Sorry if its not what is required... :S

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM