Monday, April 15, 2019

conditional statements - Jade radio button checked condition

I have form in Jade file, and I want it to be pre-filled with some values that come from backend.In the form, there are radio buttons for user gender.


input(type="radio", name="gender_filter", value="1") Male
input(type="radio", name="gender_filter", value="0") Female

Now I also have this variable gender_param, and I want the corresponding button to be selected when page loads.
In PHP, I could do this:


>

Is there the corresponding syntax for Jade? Or I need to write it in the long way with line duplicates like


- if gender_param==1
input(type="radio", name="gender_filter", value="1", checked) Male
- else
input(type="radio", name="gender_filter", value="1") Male

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...