0

At first I apologize for not having the code of my desire & I've no idea how I'll ask the exact question by focusing any specific keywords.

However, I want to show my product information in an area(div) whenever I click a button in another area(div). & The work should be done without refreshing pages.

Again I apologize for that I've not the code. But I can provide an image and hope you'll understand my desire enter image description here

Example: Whenever I click on angry burger, the price and quantity should be shown in the right(California Fried Chicken) area. And multiple selecting product should also work one by one. After that I should be able to submit product information bu pressing submit button where a PHP operation should be done.

I want to do the whole task by jQuery & PHP

Thanks

S M Iftakhairul
  • 1,120
  • 2
  • 19
  • 42

1 Answers1

0

You can achieve this by setting up click listeners in your javascript/jquery code and assign them to the ids of your pictures or fields. For example you can assign an id to an tag like below;

<p id="div">Hello world</p>

And then set up a click event in your jquery code to execute a function whenever that tag is clicked

$( "#div" ).bind( "click", function() {
          var tag = $(this).html(); //get the value of the tag
         alert(tag);//this will display Hello world
});

You can do this for any tag and retrieve its value or contents or anything and carry out an activity like changing the display of another element as below

$("#change").append(tag) //this will change the display of the tag with id change 

Please ask if you have any questions

Douglas Hosea
  • 1,002
  • 13
  • 30
  • But its appending every time i click. It should append only once – S M Iftakhairul Mar 25 '17 at 14:01
  • Then set up a variable that will hold the id of the last clicked element. Then in the click method, check if the id of the clicked element is equal to the variable. If equal, do nothing, else, append or if you want to replace the text remove append and use ("#element").val("Text to replace") – Douglas Hosea Mar 25 '17 at 14:11