@@ -125,7 +125,7 @@ const MetaTraderUI = (() => {
125125
126126 $ddl_trade_server
127127 . append (
128- $ ( '<div />' , { id : trading_server . id , class : 'gr-padding-10 gr-parent' } )
128+ $ ( '<div />' , { id : trading_server . id , class : 'gr-padding-10 gr-parent trade-server-item ' } )
129129 . append ( $ ( '<input />' , input_attributes ) )
130130 . append ( $ ( '<label />' , { htmlFor : trading_server . id } )
131131 . append ( $ ( '<span />' , { text : label_text } ) )
@@ -821,16 +821,13 @@ const MetaTraderUI = (() => {
821821 } ) ;
822822
823823 $form . find ( '#ddl_trade_server' ) . off ( 'click' ) . on ( 'click' , ( e ) => {
824- $form . find ( '#ddl_trade_server' ) . find ( 'input' ) . not ( ':input[disabled]' ) . removeAttr ( 'checked ') ;
824+ const $target_input = $ ( e . target ) . parents ( '.trade-server-item' ) . children ( 'input ') ;
825825
826- if ( e . target . nodeName === 'SPAN' ) {
827- $ ( e . target . parentElement ) . parent ( ) . find ( 'input' ) . not ( ':input[disabled]' ) . attr ( 'checked' , 'checked' ) ;
828- }
829- if ( e . target . nodeName === 'LABEL' ) {
830- $ ( e . target . parentElement ) . find ( 'input' ) . not ( ':input[disabled]' ) . attr ( 'checked' , 'checked' ) ;
831- }
832- if ( e . target . nodeName === 'INPUT' ) {
833- $ ( e . target ) . not ( ':input[disabled]' ) . attr ( 'checked' , 'checked' ) ;
826+ if ( $target_input . attr ( 'disabled' ) ) return ;
827+
828+ if ( $target_input . length ) {
829+ $form . find ( '#ddl_trade_server' ) . find ( 'input' ) . not ( ':input[disabled]' ) . removeAttr ( 'checked' ) ;
830+ $target_input . not ( ':input[disabled]' ) . attr ( 'checked' , 'checked' ) ;
834831 }
835832
836833 const new_user_submit_button = $form . find ( '#new_user_btn_submit_new_account' ) ;
0 commit comments