1

I am using knockout js to bind the list of links in my table here is the code

  <table class="table table-bordered">
            <thead>
                <tr>
                    <th style="width:10%;">#</th>
                    <th style="width:50%;">Link</th>
                    <th style="width:20%;">Active</th>
                    <th style="width:20%;">Action</th>
                </tr>
            </thead>
            **<tbody data-bind="foreach:LinkList">**
                <tr>
                    <td data-bind="text:$index()+1"></td>
                    <td><span data-bind="text:$data.LinkName.length <= 40 ? $data.LinkName : $data.LinkName.substring(0, 40) + '...'"></span></td>
                    <td>
                        <input type="checkbox"  data-bind="checked:$data.IsActive" disabled />
                    </td>
                    <td>
                        <button class="btn btn-xs btn-primary" type="button" title="Edit"
                                data-bind="click:$parent.OnClickEditBtn">
                            <span class="glyphicon glyphicon-edit"></span>
                        </button>
                        <button class="btn btn-xs btn-danger" type="button" title="Delete"
                                data-bind="click:$parent.OnClickDeleteBtn">
                            <span class="glyphicon glyphicon-trash"></span>
                        </button>
                    </td>
                </tr>
            </tbody>
        </table>

Here I used the foreach to bind the list of links to display it on HTML page I am attaching the link of that page also http://growingtab.com/links

but when you inspect the html page in page source then link is not showing in its source code? so how can i display those links in page source also? Is there is any way to show it?

Gaurav_0093
  • 1,040
  • 6
  • 28
  • 56
  • please help still didn't any response – Gaurav_0093 Feb 06 '17 at 13:09
  • Can you share your viewmodel? – GôTô Feb 06 '17 at 15:53
  • I don't think there's a way to do that. The source is the source. Why do you need them to show up in the source in the first place? You could probably display the links in another section on the rendered page instead if you just need visitors to be able to see their code. – Jason Spake Feb 06 '17 at 16:40

1 Answers1

1

The source code displayed is whatever the server returns for the client when the page is requested -- you are actually making DOM manipulations which won't modify the original source. What you can do is to check the DOM's current state with a developer tool like Firebug or move the logic to the server side which will return the generated HTML.

jQuery DOM changes not appearing in view source

createElement() not showing up in view source

Community
  • 1
  • 1
Rafael Companhoni
  • 1,780
  • 1
  • 15
  • 31