Skip to content

How to use click event on page load in knockout

<div class="free-sample" id="free-sample-component" data-bind="scope:'free_Sample_Component'">
    <button id="get-free-sample" data-bind="click:getFreeSample">Get Free Sample</button>
</div>

Above work in fine when click on free sample button but i want to use onload event. when page loaded then ‘getFreeSample’ should trigger.