dimanche 26 avril 2015

Conditional testing in Javascript

I am trying to conditionally have a <div> be displayed if the numeric input is 18 and above and the YO option is selected. Any assistance would be greatly appreciated. Code below.

<input type=numeric id=ageSelf ng-model="ageSelf" style="color:black">
    <select ng-model="ageUnit" style="color:black">
        <option selected value=YO>YO</option>
        <option>MO</option>
        <option>WO</option>
    </select><br>

<script type=text/javascript>
var jq = $.noConflict(); //I am also using angularjs hence the variable
jq(document).ready(function(){
jq("#ageSelf").change(function(){
//conditional for ageSelf
if(jq("#ageSelf").val >= "18"){
    if(jq("#ageUnit") == YO){
        jq("#over18").show();
    }
    }else{
        jq("#under18").show();
    }           
    });     
});

Aucun commentaire:

Enregistrer un commentaire