xt = $(element).text(); var oldId = $('#browse-search-submenu a').attr('id'); var oldText = $('#browse-search-submenu a').text(); //swap $(element).attr('id',oldId); $(element).text(oldText); $('#browse-search-submenu a').attr('id',newId); $('#browse-search-submenu a').text(newText); prepareFormforSubmit(newId); toggleVisibility(); } function prepareFormforSubmit(searchType) { $('#hiddenArticle').remove(); $('#hiddenCat1').remove(); $('#hiddenCat2').remove(); $('#methodaction').remove(); $('#searchType').removeAttr('value'); $('#searchterm').attr('name','searchterm') switch (searchType) { case 'all': $('#site-search-form').attr('action',"/careers/text-search.html"); break; case 'articles': $('#site-search-form').attr('action',"/careers/advice/article-search.html"); var eleInput = document.createElement('input'); $(eleInput).attr('type','hidden'); $(eleInput).attr('id','hiddenArticle'); $(eleInput).attr('name','action'); $(eleInput).attr('value','newTextSearch'); $('#site-search-form').append( $(eleInput)); $('#searchterm').attr('name','searchTerm') break; case 'jobs': $('#site-search-form').attr('action',"/careers/submit-advanced-search.html"); $('#searchterm').attr('name','keywords'); $('#searchType').attr('value','jobsearch'); break; case 'courses': $('#site-search-form').attr('action',"/careers/submit-advanced-search.html"); $('#searchterm').attr('name','keywords'); $('#searchType').attr('value','courses'); var eleHiddenCat1 = document.createElement('input'); $(eleHiddenCat1).attr('type','hidden'); $(eleHiddenCat1).attr('id','hiddenCat1'); $(eleHiddenCat1).attr('name','categories'); $(eleHiddenCat1).attr('value','2'); $('#site-search-form').append( $(eleHiddenCat1)); break; case 'classified': $('#site-search-form').attr('action',"/careers/submit-advanced-search.html"); $('#searchterm').attr('name','keywords'); $('#searchType').attr('value','courses'); /* 2 hidden parameters defining non educational courses */ var eleHiddenCat1 = document.createElement('input'); $(eleHiddenCat1).attr('type','hidden'); $(eleHiddenCat1).attr('id','hiddenCat1'); $(eleHiddenCat1).attr('name','categories'); $(eleHiddenCat1).attr('value','1'); $('#site-search-form').append( $(eleHiddenCat1)); var eleHiddenCat2 = document.createElement('input'); $(eleHiddenCat2).attr('type','hidden'); $(eleHiddenCat2).attr('id','hiddenCat2'); $(eleHiddenCat2).attr('name','categories'); $(eleHiddenCat2).attr('value','7'); $('#site-search-form').append( $(eleHiddenCat2)); break; case 'employers': $('#site-search-form').attr('action',"/careers/employer-profile-search.html"); $('#searchterm').attr('name','searchTerm'); break; } }
You are currently not logged in to BMJ Careers.