Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which button is clicked

 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i creates multiple buttons on jsp through loop.
now i want to access which button is clicked
how can i do it?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your post is too vague to give a substantive answer to.

What kind of buttons? Where do you need to know, client or server? etc...
 
Vijitha Kumara
Bartender
Pie
Posts: 3918
10
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For HTML, "onclick" attribute of each button (input tag) you can call a Javascript function passing a value which identifies the button clicked.
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for(int i=0;i<5;i++)
{
%>
<input type="button" onclick="fun1()">
<%
}



<script type="text/javascript">
function fun1()
{
//what code should be written here
}

</script>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so this is a JavaScript question... Please take the time to choose the correct forum for your posts. This forum is for questions on XYZ. For more information, please read this.

This post has been moved to a more appropriate forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're easiest course would be to use separate handlers for each button.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pass the object:






Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic