When the & lt; s: radio/& gt; tag of Struts2 is used, you want to add a change event to it. Because this tag automatically generates a radio group for the page, it cannot be controlled as usual. I spoke a lot on the Internet and did not find a satisfactory one. If you set an id for this & lt; s: radio/& gt; as before, generate... SyntaxHi
Use Struts2 You want to add a change event to a tag. Because this tag automatically generates a radio group for the page, it cannot be controlled as usual. I spoke a lot on the Internet and did not find a satisfactory one. If you give this Set an id. A number is automatically added to the generated radio group, for example:
No
Yes
In this case, jquery can be used for implementation, which is very simple. Add cssClass = "filetype" to add a css class for each radio. The following code is shown:
[Javascript]
$ (Function (){
$ (". Filetype"). change (function (){
Var val = $ ("input [name = 'file']: checked"). val (); // obtain the value of the selected radio
If (val = '1 '){
Alert ("yes ");
} Else {
Alert ("no ");
}
});
});
$ (Function (){
$ (". Filetype"). change (function (){
Var val = $ ("input [name = 'file']: checked"). val (); // obtain the value of the selected radio
If (val = '1 '){
Alert ("yes ");
} Else {
Alert ("no ");
}
});
});
You can perform corresponding operations each time you select radio.