html5 - How to programmatically change the text of an anchor tag in a JSP -


i able change text of anchor tag based on value of status field. on pageload student-status set ajax request. after check status , see if active, hyperlink should "deactivate" otherwise activate. below doing test hardcoding status field active. use value in id =student-status. there way set status variable similar $("#student-status).text() example here below:

<tr>   <td>status</td>   <td id="student-status"></td>    <c:set var ="status" scope="session" value="active" /> <!-- want value td -->    <c:choose>     <c:when test = "$(status == 'active')">      <td class="new-student-status"><a id="activate-deactivate-student" href="#">deactivate</a></td> </c:when> <c:when test = "$(status== 'inactive')"> <td class="new-student-status"><a id="activate-deactivate-student" href="#">activate</a></td> </c:when> </c:choose> </tr> 

try 1 line:

<td class="new-student-status">    <a id="activate-deactivate-student" href="#">       <c:out value="$(status == 'active'?'deactivate':'activate')"/>    </a> </td> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -