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:
<input type="radio" name="gender_filter", value="1" <?php echo ($gender_param==1)?"checked":''; ?>>
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