div click event automatically getting fired on page load

Viewed 9643

I want to create html page which has series of ( e.g.div has list of employee details ). When user click on div I want to navigate to another page. Please have a look at this.

Problem is click event of div is getting fired when I am loading page for the first time. How can I avoid unnecessary click events those are getting fired during page load event?

Below is my html code

<div data-bind="click: clickMe('ok1')">
    <h1>Emplyee details</h1>
    <p>This is test</p>    
</div>

<div data-bind="click: clickMe('ok2')">
    <h1>Emplyee details</h1>
    <p>This is test</p>    
</div>

var ViewModel = function(){
    var self = this;
    self.clickMe = function(url){   
        //This function is automatically getting called 
        //when page loads.
        alert(url);
    }
}
ko.applyBindings(new ViewModel());

Regards, Hemant

1 Answers
Related