$(function () { $('#gnaviselect').change(setGnaviTextPlaceholder); setGnaviTextPlaceholder(); }); function setGnaviTextPlaceholder() { val = $('#gnaviselect').val(); if(val=='01'){ $('#gnavitext').attr('placeholder','例)家庭料理、薬膳、先生名、教室名'); } else if(val=='02'){ $('#gnavitext').attr('placeholder','例)おもてなし、手ごね、体験、料理名'); } else if(val=='03'){ $('#gnavitext').attr('placeholder','例)料理名'); } } $(function() { $('.navFormSubmit').click( function() { val = $('#gnaviselect').val(); keyword = $('#gnavitext').val(); //alert(val + '/' + keyword); if(val=='01'){ trackEvent('SearchClick_PC', 'school', keyword); } else if(val=='02'){ trackEvent('SearchClick_PC', 'lesson', keyword); } else if(val=='03'){ trackEvent('SearchClick_PC', 'recipe', keyword); } } ); $('#recipeSubmit').click( function() { keyword = $('#recipetext').val(); //alert(keyword); trackEvent('SearchClick_PC', 'btn_recipe', keyword); } ); $('#schoolSubmit').click( function() { keyword = $('#schoolareatext').val() + ',' + $('#schoolfreetext').val(); //alert(keyword); trackEvent('SearchClick_PC', 'btn_school', keyword); } ); $('#lessonSubmit').click( function() { keyword = $('#lessontext').val(); //alert(keyword); trackEvent('SearchClick_PC', 'btn_lesson', keyword); } ); });