function mycode() { $("[name='searchtext']").val(inputArray[n]); $("button").click(); output[n] =$("span#outcome").text(); output[n] = ("|"+n+"|").concat(output[n]); n+=1; } var inputArray = ['A','B','C','D','E','F']; var output = []; var n = 0; $(document).ready(function() { setInterval(mycode(), 100); }) $("#outcome").change(function() { setInterval(mycode(), 1000); });
Basically you enter a value into the form field as a job title (A, B, C ect here for simplicity), press the button and then a value is generated located in the "salary" element. I want to do this for a list of job titles and store the salary values in an array (output[])
Here is the html of the form:
<form id="salarySearchHolder" action="/einkommen/search" method="post" name="suche_form"> <fieldset> <input class="input" type="text" value="A" maxlength="100" placeholder="Jobtitel oder Berufsbezeichnung" name="searchtext"> <span class="col col--one u-hidden u-show@lg">in</span> <input class="input" type="text" value="Berlin" autofocus="autofocus" maxlength="100" placeholder="Ort, Bundesland oder PLZ" name="location"> <button class="searchButton" onclick="javascript:checkLocationInput();">Berechnen</button> </fieldset> </form> <div class="salary--wrapper"> <div id="salary-container" class="col salary"> <span id="salary" class="o-salary">34.615 - 47.582 €</span> <span class="JS_SearchModule-calcSelect o-salary-changer col u-hidden@lg" onclick="ga('send', 'event', 'jobLocationSearch', 'Jahresdarstellung');" data-viewtype="monthly" data-ajaxurl="/ajax /setSalaryType">brutto / Jahr</span> <a class="icon-info o-salary-data u-hidden@lg" onclick="ga('send', 'event', 'infoIcon', 'Gehaltsspanne');" title="Hinweis zu den Gehaltsspannen" href="/einkommen/gehaltsdaten"></a> <span class="salarySwitch u-float-left u-hidden u-show@lg"> <div class="u-hidden u-show@lg u-float-left salaryCalcContainer"> <a class="icon-info o-salary-data u-float-left u-hidden u-show@lg" onclick="ga('send', 'event', 'infoIcon', 'Gehaltsspanne');" title="Hinweis zu den Gehaltsspannen" href="/einkommen/gehaltsdaten"></a> </div>