0

Here is my jsp code

<%
String amount = properties.get("./amount","");
String amount1 = properties.get("./amount1","");
for(i=0;i<7;i++){
%>
<div class="className-<%=i%>">
  <div class= first<%i%>>
   <%=amount%>
  </div>
  <div class= second<%i%>>
  <%=amount1%>
</div>
</div>
<%}
%>

How can i get the value of amount and amount1 in jquery ?

user2142786
  • 1,484
  • 9
  • 41
  • 74

3 Answers3

0

Try it :

<script>
var amount = <%=amount%>;
</script>
Sadikhasan
  • 18,365
  • 21
  • 80
  • 122
0

e.g:

for(i=0;i<7;i++){var amount = $('.first'+i).text(); var amount1 = $('.second'+i).text();}

BTW, did you miss the "=" in "<%i%>"?

Kingson
  • 41
  • 2
0

If I clearly understand your question you can try assigning value of amount to a hidden input and can get easily in jquery.

<input type = "hidden" id = "amountId" value = "<%=amount%>">

Is that you need let me know.

Dhruv Pal
  • 849
  • 2
  • 10
  • 25