javascript - Run Jquery/JS function on button click with parameter -


I have 5 buttons, which all need to click or run the same function, which can The best way is .. but I have to pass the button ID as a parameter on the function. The button functions are running BuyItem (Button ID), I have to keep the button in the past so that I can run the same function and only find out why they are buying based on the passage of the button ID.

The button is being created in my PHP file

  & lt; Input type = 'button' id = '$ id' name = '$ id' onsubmit = "funciton ($ id)" style = 'width: 185px; 'Value =' buy equipment '& gt;  

I do not know how it works, how should I call the function, but when the button is clicked, then I should have an id passing the function

this.id will present the current ID of the element

  & Lt; Input type = 'button' id = '$ id' name = '$ id' subtitle = "funciton (this.id)" style = 'width: 185px;' Value = 'buy equipment' & gt;  

Then your JS will be

  Phoenix (ID) {alert}; }  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -