I have a series of clicks:
console.log('1')
$('.tool-projects').click()
console.log('2')
$('#drawer-projects > ul > li > div > div.tool > div.jellybean-container.jelly-beans > span > input.typeahead.tt-input').click(function() {
console.log('3')
var project = 'attribution'
$('.suggestion-value:contains('+project+')').click()
console.log('4')
$('.btn-primary')[0].click();
and I want for the page to wait for one click to finish before moving on to the second. I tried this to no avail.
$('.tool-projects').click(function() {
console.log('2')
$('#drawer-projects > ul > li > div > div.tool > div.jellybean-container.jelly-beans > span > input.typeahead.tt-input').click(function() {
console.log('3')
var project = 'attribution'
$('.suggestion-value:contains('+project+')').click(function() {
console.log('4')
$('.btn-primary')[0].click();
});
})
});
This just prints out 1
. I looked at the documentation - https://api.jquery.com/click/
.click( handler )
handler
Type: Function( Event eventObject )
A function to execute each time the event is triggered.
I thought my solution would work, maybe I just misunderstood how to implement it? Is there a way to have a callback on a click?
To explain why I need to do this:
clicking .tools-projects
opens a drop down menu
until that's clicked, '#drawer-projects'
doesn't exist. Once that does exist, I need to click it which opens the .suggestion-value
dropdown menu, so I can access the project attribution