samedi 10 février 2018

Multiple Divs to hide with checkbox and day

first of all hello from a newbie. I searched a lot but i didn't find any result on it, or better i get some results but not joined between checkbox and date.

I'm writing an html about a list of restaurant and i would like the user has the possibility to show, if he wish, the restaurant open in the day.

As example, i put a restaurant into a div, so 5 div for 5 restaurant.

I have a Checkbox to permit to hide the restaurant closed when flagged.

but how i can handle to hide all the divs with same closed day (day of closing corresponding to system date using getday() ) when the checkbox is flagged?

In my mind, i have a code written that when checkbox is flagged, a variable XX will have a value Z for day and a variable YY will have a value "display: none;". Any suggestion ?? tks for your time and help

In the example below, let's suppose we are on monday, i flag the checkbox and restaurant 1, 4 and 5 will not be shown

<div id="restaurant 1" style=""> <!-- main div for restaurant 1 -->
        .........       <!-- closed on monday, so value 1 from getday() -->         
</div>
<div id="restaurant 2" style=""> <!-- main div for restaurant 2 -->
    .........           <!-- closed on saturday, so value 6 from getday() -->       
</div>
<div id="restaurant 3" style=""> <!-- main div for restaurant 3 -->
    .........               <!-- closed on friday, so value 5 from getday() --> 
</div>
<div id="restaurant 4" style=""> <!-- main div for restaurant 4 -->
    .........           <!-- closed on monday, so value 1 from getday() -->     
</div>     
<div id="restaurant 5" style=""> <!-- main div for restaurant 5 -->
    .........           <!-- closed on monday, so value 1 from getday() -->     
</div>




Aucun commentaire:

Enregistrer un commentaire