javascript - How to disable/enable input elements until/before date? -


i have simple form input elements, this:

<form action="..." method="post" id="myform"> <p>early bird price</p> <p> <label for="earlymember">members: 100 usd</label>     <input type="radio" id="earlymember" value="early bird members, 100 usd"> <label for="earlynotmember">not members: 120 usd</label>     <input type="radio" id="earlynotmember" value="early bird not members, 120 usd"> </p> <p>normal price</p> <p> <label for="normalmember">members: 200 usd</label>     <input type="radio" id="normalmember" value="normal members, 100 usd"> <label for="normalnotmember">not members: 120 usd</label>     <input type="radio" id="normalnotmember" value="normal not members, 120 usd"> </p> 

how can disable #normalmember , #normalnotmember radios until date, example 2015-09-30 in jquery or simple javascript?

(of course after date need change these radios enabled , disable others.)

i highly recommend compare dates on server-side before , after form submissions because end-users override client-side code. however, still provide client-side solution since did not mention server-side environment.

$(document).ready(function() {    var mydate = new date("2015-09-30");    $('#normalmember,#normalnotmember').prop('disabled', $.now() < mydate.gettime());  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>    <form action="..." method="post" id="myform">    <p>early bird price</p>    <p>      <label for="earlymember">members: 100 usd</label>      <input type="radio" id="earlymember" value="early bird members, 100 usd">      <label for="earlynotmember">not members: 120 usd</label>      <input type="radio" id="earlynotmember" value="early bird not members, 120 usd">    </p>    <p>normal price</p>    <p>      <label for="normalmember">members: 200 usd</label>      <input type="radio" id="normalmember" value="normal members, 100 usd">      <label for="normalnotmember">not members: 120 usd</label>      <input type="radio" id="normalnotmember" value="normal not members, 120 usd">    </p>


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -