How to get the value of an express handlebar variable in a each handlebar helper with modals in jquery?

Viewed 123

I'm trying to get the value of an express handlebar {{this.shortName}} which was in an "each" handle bar helper. Im trying to get the this.shortName of the value then transfer it to to the attribute of the modal since its in a table format. I have no idea on how to do it in jquery.

This is my code in HTML:

  {{#each college}}
    <tr>
      <th scope="row"></th>
      <td>{{{@index}}{{this.shortName}}</td>
      <td>{{@index}} {{this.longName}}</td>
      <td>
        <div class="dropdown">
          <button class="btn btn-primary btn-sm text-white dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            Action
          </button>
          <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
            <a class="dropdown-item" class="text-center" data-toggle="modal" data-target="#modaledit">Update Info</a>
            <a class="dropdown-item" class="text-center" data-toggle="modal" data-target="#modaldelete">Delete College</a>
            <a class="dropdown-item" class="text-center" href="/colleges/{{this.shortName}}">Go to College</a>
          </div>
        </div>
      </td>
    </tr>
  {{/each}}

I hope I'll get the answer right. Thank you :)

0 Answers
Related