I'm trying to trigger a click on an input field on page load. The input field is placed within a form.
HTML:
<form>
.... other fieldsets ....
<fieldset>
<ul class="chosen-choices">
<li class="search-field">
<input class="default" type="text" style="width: 147px;" autocomplete="off" value="Choose a category…">
</li>
</ul>
</fieldset>
.... other fieldsets ....
</form>
jQuery
<script>
$('.default').trigger('click',function() {
console.log( '.trigger() called.');
});
console.log('done');
</script>
The jQuery trigger is not run, as nothing appears in console, besides the 'done' log.
I want to trigger a click on the input field with class "default".