- Posts: 3
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<div id="tfheader"> <form id="tfnewsearch" method="get" action="https://www.onetonline.org/find/quick?s="> <input type="text" placeholder="Enter Your Job Title..." class="tftextinput" id="tftextinput" name="q" size="26" maxlength="120"><input type="submit" value="Search O*NET Occupations" class="tfbutton"> </form> <div class="tfclear"></div> </div> <script> var a = document.getElementById('tfnewsearch'); a.addEventListener('submit',function(e) { e.preventDefault(); var b = document.getElementById('tftextinput').value; window.open('https://www.onetonline.org/find/quick?s='+b) }); </script>
<form id="tfnewsearch" method="get"><input class="tftext" id="tftextinput" maxlength="120" name="q" placeholder="Enter Your Job Title..." size="26" type="text" /><input class="tfbutton" type="submit" value="Search O*NET Occupations" /> </form> <script> var a = document.getElementById('tfnewsearch'); a.addEventListener('submit',function(e) { e.preventDefault(); var b = document.getElementById('tftextinput').value; window.open("https://www.onetonline.org/find/quick?s="+b) }); </script>
<div class="search-wrapper" style="background:#FFFFFF; padding: 20px; margin: 20px; color: #2C3E50;"> <input class="tftext" id="tftextinput" maxlength="120" placeholder="Enter Your Job Title..." size="26" type="text" style="border:1px solid #233140;" /> <button id="tfbutton" type="button" value="Search O*NET Occupations" style="margin-left:8px;" />Search O*NET Occupations</button> </div> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#tfbutton').on('click', function(e) { e.preventDefault(); var b = $('#tftextinput').val(); window.open("https://www.onetonline.org/find/quick?s="+b) }); }); </script>
<input class="tftextinput" id="tftextinput2" maxlength="120" name="q" placeholder="Enter Your Job Title..." size="26" type="text" /><input class="tfbutton" id="tfnewsearch" type="button" value="Search O*NET Occupations" /> <div class="tfclear"> </div> <script type="text/javascript"> $("body #tfnewsearch").on("click",function(){ var b = $("#tftextinput2").val(); window.open("https://www.onetonline.org/find/quick?s="+b) }); </script>
No, because you're in the LimeSurvey form, "Enter" will submit that.One follow-up: is it possible to use "enter" to execute the search function after a respondent places text in the box?