kumar
kumar

Reputation: 3

How do display the data in html table after clicking an option in dropdown based on that option id?

I have an Html table that will return a list of user's info by Admin id. I have a dropdown in that same Html page that will return all the users(ie. User name and User Id), on clicking of the particular username table data has to be changed by this particular user details.

Can any one help me in this..?

Upvotes: 0

Views: 243

Answers (1)

Ilia Afzali
Ilia Afzali

Reputation: 429

Let's assume you have an function that returns User Details with name getUserData :

getUserData(userId){
   /// Some Codes
}

You should call this function when select element's Selected Value has been changed, you can do it with jQuery like this :

$('#usersDropDown').on('change', function() {
  getUserData(this.value)
});

And your select element should be like this :

<select id="usersDropDown">
<option value="1">User1</option>
</select>

Upvotes: 1

Related Questions