Disable and enable multiple option tag

38
July 20, 2018, at 11:00 PM

I want to disable and enable my option tag value using jQuery. I tried it but I didn't get solution. I want to disable and enable multiple option tag.

echo ' <select class="form-control show-tick">';
while($tNow <= $tEnd){
    if($tNow <= strtotime(date('G:i'))){ 
        $prop ='disabled';  
    }else{ 
        $prop=''; 
    }
    echo '<option id="posttimes" value="'.date("H:i",$tNow).'" '.$prop.'>'.date("H:i",$tNow).'</option>';
    $tNow = strtotime('+15 minutes',$tNow);
}
echo '</select>';
$("#post_date").on("change", function(){
    var selected = $(this).val();
    var dateString = $("#post_date").val();
    var myDate = new Date(dateString);
    var today = new Date();
    if(myDate>today){
        var intsize=document.getElementsByTagName("option");
        for(var i = 0; i < intsize.length; i++) {
            intsize[i].disabled = false;
        }  
        //Here I want to enable the option tag value
    }
    if(myDate<today){
        var intsize=document.getElementsByClassName("disabled");
        for(var i = 0; i < intsize.length; i++) {
            intsize[i].disabled = true;
        }
        //Here I want to disable the option tag value
    }
})
READ ALSO
Print IFrame content generated dynamically

Print IFrame content generated dynamically

I am trying to print a HTML page in IFrame generated dynamically, with this code bellow:

34
Jquery Datatable - AJAX- No records handler

Jquery Datatable - AJAX- No records handler

I am loading data into my datatable using ajaxThis is the code:

10
How to make waypoint route from current position to db location

How to make waypoint route from current position to db location

I need to make a way point between the locatonpng to place

23
jQuery plugins not working when using webpack. What is correct way to use it?

jQuery plugins not working when using webpack. What is correct way to use it?

I was try yo use webpack in my developmentI use npm, install jquery and some plugins (YTPlayer, fancybox)

39