Home Need to change the value of a variable using javascript
Reply: 0

Need to change the value of a variable using javascript

user1346 Published in June 23, 2018, 5:32 pm

I have dug and dug for a few hours today without much luck. My language is PHP and my javascript skills are not that great I am learning.

I have a list of buttons, each with their own value. When the button is pressed I would like for it to send the value of that button to a variable so the right file is loaded.

I know that this has got to be a simple thing but it's beyond me right now.


<button type="button" id="myButton" onClick="setval('shannen')" class="btn btn-primary cd-btn">VIEW</button>

<button type="button" id="myButton" onClick="setval('fall-features')" class="btn btn-primary cd-btn">VIEW</button>

var content_div = document.getElementsByClassName("cd-panel-content"); 
$(document).ready(function() {
}) console.log(mysample);

 function setValue() {
    var mysample=$("#myButton").val();
    var mysample=mysample+".html";

When they click it a window opens on the right of the screen displaying an HTML file.

www.jeffcade.com to see the functionality. I have gotten it to work with one variable but then it will not change when a different button is pressed.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30891 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO