0

Below image is pointing the value of username (updatedBy) i.e 52038862. I want to print this value by calling the variable which stores this value. The value displayed in the table.

enter image description here

How to fetch the variable name and print this in javascript console. I need to display this value in some other pages. I am newly debugging the application. I am stuck at this point. Below is my jsp code.

<label>Approval History</label>        
            </div>
            <div class="tile-body">
                <div class="tableWrapAtX">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>Date/Time</th>
                                <th>User</th>
                                <th>Email Address</th>
                                <th>Old Status</th>
                                <th>New Status</th>
                                <th>Comment</th>                                
                            </tr>
                        </thead>
                        <tbody>                                         
                            <!-- ko foreach: approvalAuditTrail -->
                                <tr>
                                    <td><span data-bind="text: updated"></span></td>
                                    <td><span data-bind="text: updatedBy"></span></td>
                                    <td><span data-bind="text: updatedByEmail"></span></td>
                                    <td><span data-bind="text: oldStatus"></span></td>
                                    <td><span data-bind="text: approvalStatus"></span></td>
                                    <td><span data-bind="text: comments"></span></td>
                                </tr>
                            <!-- /ko -->
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

2
  • Is that value stored in a variable or just in the html Commented Mar 31, 2019 at 7:56
  • I have updated the question's description. Added the jsp code from approval.jsp Commented Mar 31, 2019 at 8:03

1 Answer 1

1

Could you assign an ID to the field and reference it that way?

<td><span id="updateby" data-bind="text: updatedBy"></span></td>

Create a variable $foo to reference this data in the DOM.

$foo = document.querySelector('span#updateby');

Retrieve properties of the $foo variable, specifically the actual int values

$foo.textContent;

There are different ways to reference as well and this simple example is based on my understanding of the question.

Google Chrome console output

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.