I am trying to click a button based on the fact that it is starting with the id "submitButton_" given that what comes afterwards keeps on changing (e.g. "submitButton_10a313c673cee"). This is what the button looks like:
<a href="#" class="btn btn-default" role="button" id="submitButton_10a313c673cee">Continue</a>
using the following code, I can click the button:
tell application "Safari"
do JavaScript "$(id='submitButton_10a313c673cee').click();" in document 1
end tell
Therefore, from other questions (e.g. jquery selector for id starts with specific text) I thought I could click it using:
do JavaScript "$(id^='submitButton_').click();" in document 1
However, this does not work. I also tried multiple permutations all of which didn't work, e.g.:
do JavaScript "$('[id^=submitButton_]').click();" in document 1
Any help would be highly appreciated.