java - How to see name inside the link after renaming by jQuery? -


jsp loop:

<c:foreach items="${feedlist}" var="feed">     <input type="hidden" readonly="readonly" id="feedid"         value="<c:out value="${feed.id}" />" />     <tr>         <td class="feed-name" id="<c:out value="${feed.id}" />"><c:out                 value="${feed.name}" /></td>         <td><a             href="feedcontroller?action=delete&id=<c:out value="${feed.id}"/>">delete</a>         </td>         <td><a             href="feeditemcontroller?action=feeditemlistasc&id=<c:out value="${feed.id}"/>">view</a></td>         <td><button                 onclick="openeditdialog('${feed.id}', '${feed.name}' )" name="modal">edit</button></td>     </tr> </c:foreach> 

i want make feed.name inside view button this:

<c:foreach items="${feedlist}" var="feed">     <input type="hidden" readonly="readonly" id="feedid"         value="<c:out value="${feed.id}" />" />     <tr>         <td class="feed-name" id="<c:out value="${feed.id}" />"><a             href="feeditemcontroller?action=feeditemlistasc&id=<c:out value="${feed.id}"/>"><c:out                     value="${feed.name}" /></a></td>         <td><a             href="feedcontroller?action=delete&id=<c:out value="${feed.id}"/>">delete</a>         </td>          <td><button                 onclick="openeditdialog('${feed.id}', '${feed.name}' )" name="modal">edit</button></td>     </tr> </c:foreach> 

but jquery edir button after renaming $('.feed-name[id="' + id + '"]').text(name); removes link. becomes visible link after refreshing page.

you're over-writing content in target selector .feed-name when use .text()

if want target link, you'll need this:

$('.feed-name[id="' + id + '"] > a').text(name) 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -