Jump to content

JavaScript - Multiple Buttons / Value to Listbox not working


Recommended Posts

the following is the basic code i'm using however when i transfer it to my php file with a few edits to work with php variables the code stops working

https://jsfiddle.net/a04ust13/

Not sure what the problem is any help would be appreciated

Thanks

Nick

Screenshot_119.png

Screenshot_118.png

:psychic:

It "stops working" doesn't actually mean anything. What does it do? What do you expect it to do?

And post all of your code - not just some partial jsfiddle with a couple bits that don't actually match what your real code is.

I have a list of 728 players shown in the webpage picture that was previously posted - the value of the Button is the Players' Name so the Javascript function grabs that value when posting it to the Listbox on the right - once populated the listbox is processed to create team database entries previously it didn't post the Name Values to the Listbox however i figured it out seeing how each button needed a unique name and id and also had to create a unique Event Listener for the JavaScript to work fiddle link is as follows and i edited the code to work in my script a bit - pictures of the code is posted below....

https://jsfiddle.net/a04ust13/1/

Everything works now - by posting in here and writing down everything made me realize what was wrong

Screenshot_120.png

Screenshot_121.png

Screenshot_122.png

Glad you got it figured out.  For future reference, you can save yourself a lot of pain by just using the code tag feature of the forum.  It's the <> button on the ribbon at the top of the editor.  Just hit it and paste in your code snippet, then choose the language. 

Example:

let age=5
for (let x=1; x < 25; x++) {
  age++
  console.log(`Person is now ${age}.`)
}

 

  • Like 1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.