jquery - javascript pararmeter pasing -
i not quite sure how describe want....but here goes nothing.
i trying have multiple buttons show/hide div (i have part set already). button have 2 values (number , letter) fill in parameter button's onclick event (these need change depending on button clicked.
for example, click button1 has values , 1. fills in parameters onclick event button 3. or can click button 2 has b , 2 , fill in b , 2 parameters button 3 (so button 3 on click parameters need change)
i have been searching day , can't seem find anything. can offer or guidance?
<input type='button' value="1" id="1" name="1" onclick="toggle();" style="background-color:lightblue; height:75px; width:75px;-webkit-appearance: none; border-radius: 70px; " /> that button needs have 2 "values" of sort hamburger
that's button needs values passed event.
var toggle = function() { var mydiv = document.getelementbyid('table1'); if (mydiv.style.display === 'block' || mydiv.style.display === '') mydiv.style.display = 'none'; else mydiv.style.display = 'block' }
it sounds me having function set global variables trick. not entirely sure of you're trying accomplish:
you can pass whatever parms want toggle:
<input type='button' value="1" id="1" name="1" onclick="toggle(1, a)" /> and set them global vars in in js:
var parm1, parm2; var toggle = function(mychar, myint) { parm1 = mychar; parm2 = myint; }
Comments
Post a Comment