First, to ensure we're on the same page, allow me to demonstrate a working example of the JS hosted on my website
here.
A respondent is able to enter a job title, click the button, and is taken to
www.onetonline.org/find/quick?s
with the text of their search inserted at the end of the full onetonline.org url.
I attempted your edits to the best of my ability, but need to retain the form tag at some level in order to offer a text entry field. Below is what I've arrived at, but it still is not working. In light of the working example linked above, what am I still missing? Apologies for generally lacking html/JS expertise. Thanks for the help.
Code:
<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>