RDangol
RDangol

Reputation: 189

Trigger a click event on page load using knockoutJS

How do I trigger a click event of a div on page load using knockoutJS? I tried

$(document).ready(function () {
$('.divClass').first().trigger('click');
}

Upvotes: 2

Views: 1864

Answers (1)

Anders
Anders

Reputation: 17564

The whole point of MVVM is to seperate the View and the view logic (ViewModel). Instead of trigger the click trigger the function on the view model that is bound to the click

Upvotes: 1

Related Questions