Reputation: 63
I have the following code and I want to click on the Reset Button.
<div class="col-md-3 filter-buttons">
<button class="btn btn-primary"type="submit">Submit</button>
<a class="btn btn-default" href="http://return.dev/ai?reset=1">Reset</a>
</div>
I tried with
$('.filter-buttons a.btn').click();
but doesn't work. Any ideas why?
Upvotes: 1
Views: 55
Reputation: 25527
If you want to emulate the dom anchor element click, use,
$('.filter-buttons a.btn').get(0).click();
Otherwise it will trigger the jquery click event binded to that element. In this case you have not binded any click events to that anchor element.
Upvotes: 4