i'm struggling links enable respective buttons. instance first link should enable first button , second should enable button 2.
can help?
<a href="http://www.linkhere.com" onclick="document.getelementbyid("butt1").disabled=false">link 1</a> <a href="http://www.linkhere.com" onclick="document.getelementbyid("butt2").disabled=false">link 2</a> <button disabled class="btn btn-primary pull-left" id="butt1">button 1</button> <button disabled class="btn btn-primary pull-left" id="butt2">button 2</button>
your problem use of quotation marks. there 2 options:
- use single quotes
- use
"
or\22
instead of double quotes
explanation
your onclick
wrapped in double quotes. use double quote, it's end of onclick
.
solution
<a href="http://www.linkhere.com" onclick="document.getelementbyid('butt1').disabled=false">link 1</a> <a href="http://www.linkhere.com" onclick="document.getelementbyid("butt2").disabled=false">link 2</a>
demonstration
see fiddle (thanks @jamesthorpe updating escaped quote option)
note, removed href because doesn't make sense link somewhere if you're going on current page.
Comments
Post a Comment