Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Enabling Disabled Buttons in JS

Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
SpaceshipSpaceship
Watch

DanielGibbs

New Member
Impact
0
Hi, I don't know javascript so here goes.

I've created a drop down menu and when a user selects a certain option and clicks the submit button a load of information is printed about the option (in PHP).

I have a disabled button called 'button' lol and I want it to be enabled when a user clicks a certain option in the drop downlist. I tried button.disabled=false as a random guess but as I said I don't know JS lol. Worth a try.

If you can help that'd be great!

Thanks! Dan G!bbs
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Hmmm... You want it activated when what option is clicked?
 
0
•••
on the <select> tag add this

onchange='window.open(this.value,"_self")'

on your options (<option>) you should set the value as the page you want to go to
 
0
•••
Haha I suppose it's too late, but I played with this for a few minutes and got this.
Script:
function dis() {
var nah = document.frm.sel.value;
if(nah == "true"){ document.frm.lol.disabled = true; }
if(nah == "false"){ document.frm.lol.disabled = false; }
}

form:
<form name="frm">
<select name="sel" onChange="dis()">
<option> - </option>
<option value="false">Enable</option>
<option value="true">Disable</option>
</select>
<br /><br />
<input type="button" name="lol" value="Hello" onClick="alert('hello');">
</form>
 
0
•••
that looks good. Ya, If statements work wonders!
 
0
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back