「Struts2」$(this).val()でラジオの状態を取得するサンプル

2020年11月6日

構文
$('input:radio[name=xxx]’).change(function() {
//some code
})
JSコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$('input:radio[name="empData.itemA"]').change(function() {
if($(this).val() =='true') {
$('#depId').show();
// some code
} else {
$('#depId').hide();
// some code
}
});
$('input:radio[name="empData.itemA"]').change(function() { if($(this).val() =='true') { $('#depId').show(); // some code } else { $('#depId').hide(); // some code } });
$('input:radio[name="empData.itemA"]').change(function() {
    if($(this).val() =='true') {
         $('#depId').show();
         // some code
       } else {
        $('#depId').hide();
         // some code
       }

});

JSPコード
<s:radio name="empData.itemA" label="empData.itemA" list="%{false}" listValue="xxx"/>

Struts2

Posted by arkgame