i have created steps on checkout page and every step has number like 1 2 and 3 now i want to create those number through a loop like

$i = 1; $i++

how i can do this in KO Js.

image is attached http://prntscr.com/n8x2so


You can iterate to observable array Using

        <tr><th>First name</th><th>Last name</th></tr>
    <tbody data-bind="foreach: people">
            <td data-bind="text: firstName"></td>
            <td data-bind="text: lastName"></td>
<script type="text/javascript">
        people: [
            { firstName: 'Bert', lastName: 'Bertington' },
            { firstName: 'Charles', lastName: 'Charlesforth' },
            { firstName: 'Denise', lastName: 'Dentiste' }

For more example check out KOdocumentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.