Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use jQuery to update input box or label with multiple variables
    text
    copied!<p>I'm trying to learn jQuery and have a question which may be pretty simple to someone familiar with it already.</p> <p>Application: Using PHP with jQuery and Bootstrap Toggle Buttons (http://www.larentis.eu/bootstrap_toggle_buttons/) to create a dynamic link address depending on which toggle buttons the user has turned "on".</p> <p>Right now i'm using form to POST the toggle button states which once the page reloads it then pulls those POST variables and attaches them to the link.</p> <p>What I would like to do is to have jQuery automatically change the link on the page when the user toggles the button instead of having to use form post.</p> <p>What I would like to be able to do is in layman's terms explanation each time the toggle button is toggled:</p> <pre><code>$link = "http://www.mydomain.com/students.php?view=" if jQuery toggle-button-1 = on then add "name" if jQuery toggle-button-2 = on then add "id" if jQuery toggle-button-3 = on then add "address" // If toggle-button-1 and toggle-button-2 were on and toggle-button-3 was off // then $views would equal $views = "name,id" // On the webpage it would then display http://www.mydomain.com/students.php?view=name,id // If the person toggled toggle-button-1 to off, the link would display: http://www.mydomain.com/students.php?view=id </code></pre> <p>I hope i've explained this so you can understand it...it's really simple what i'm trying to do and I know how to do this in PHP but i feel like i've been searching around online for something that should be simple and I just can't seem to wrap my head around it.</p> <p>If anybody could please help me out or point me in the right direction I would greatly appreciate it!</p> <p>Thanks!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload