/********************************************* * repayment_simulation_index.js * ------------------------------------------- * - jquery.js *********************************************/ /* ------------------------------------------- * @init ------------------------------------------- */ // DOMの構築が完了したら実行 $(function(){ }); // ページの読み込みが完了したら実行 //$(document).ready(function(){ $(window).load(function(){ // ラジオボタンによる注記の制御 $('.radioNoteInput01').each(function(){ // ページロード時にラジオボタンの選択状態をリセット $('input[type="radio"]', this).attr('checked', false).on('change', function(){ // 選択したラジオボタンのtitle属性値に指定したテキストを注記へ挿入 $('.radioNoteOutput' + $(this).closest('.radioNoteInput01').attr('class').replace(/radioNoteInput([0-9]+)/, '$1')).text($('input[type="radio"]:checked').attr('title')); }); }); // テキストフィールドによる注記の制御 $('.textNoteInput01').each(function(){ // ページロード時にテキストフィールドの入力をリセット $(this).val('').on('change', function(){ // 入力したテキストフィールドの値を取得 var rateOutput, rateInput = $(this).val(); // 入力したテキストフィールドの値から該当する利率を決定 if(500 <= rateInput){ $('.textNoteOutput01').parent().fadeOut(); }else{ if(1 <= rateInput && rateInput <= 99){ rateOutput = '18.0'; }else if(100 <= rateInput && rateInput <= 300){ rateOutput = '15.0'; }else if(301 <= rateInput && rateInput <= 400){ rateOutput = '7.0'; }else if(401 <= rateInput && rateInput <= 499){ rateOutput = '4.5'; } $('.textNoteOutput01').text(rateOutput + '%以下でシミュレーションが可能です。').parent().fadeIn(); } }); }); // テキストフィールドによる注記の制御 $('.textNoteInput02').each(function(){ // ページロード時にテキストフィールドの入力をリセット var defaultNoteTxt = $('.textNoteOutput02').text(); $(this).val('').on('change', function(){ // 入力したテキストフィールドの値を取得 var rateOutput, rateInput = $(this).val(); // 入力したテキストフィールドの値から該当する利率を決定 if(2 <= rateInput){ if(2 == rateInput){ rateOutput = '12.0'; }else{ rateOutput = '18.0'; } $('.textNoteOutput02').text(rateOutput + '%以下でシミュレーションが可能です。'); }else{ $('.textNoteOutput02').text(defaultNoteTxt); } }); }); });