Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:59:07+00:00 2026-06-17T12:59:07+00:00

Concider this pseudo-ish server side code if(isFixed) { <div class=fixed> } else { <div>

  • 0

Concider this pseudo-ish server side code

if(isFixed) {
  <div class="fixed">
} else {
  <div>
}
    <p>Inner element</p>
  </div>

I try to do this in jade but…

 - if(mode === 'fixed') {
   div#tabbar
 - }
     p ...I cannot get this to be an inner element :(

It always renders like this, with the </div> closed:

<div id="tabbar"></div><p>I want this inside of the div</p>

Am I messing up the indention?
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:59:08+00:00Added an answer on June 17, 2026 at 12:59 pm

    You need to separate control flow from the template. Try this:

    divClass = null
    
    if isFixed
       divClass = "fixed"
    
    div(class=divClass)
       p inner element
    

    Which in turn might suggest factoring out the “isFixed” parameter into the actual divClass parameter to be passed on. But that depends on your remaining code/template of course.


    As an alternative, try a mixin:

    mixin content
      p inner element
    
    if (isFixed)
      div(class="test")
        mixin content
    else
      div(class="other")
        mixin content
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this pseudo code: // an image is initialized UIImage *imagePX = [[UIImage alloc]initWithContentsOfFile:...
Consider this code in a php file on my VPS server: <?php $url =
The WPF CommandManager allows you to do the following (pseudo-ish-code): <Button Name=SomeButton Command={Binding Path=ViewModelCommand}/>
Consider this code: enum { ERR_START, ERR_CANNOTOPENFILE, ERR_CANNOTCONNECT, ERR_CANNOTCONNECTWITH, ERR_CANNOTGETHOSTNAME, ERR_CANNOTSEND, }; char* ERR_MESSAGE[]
Consider this (rather pointless) javascript code: function make_closure() { var x = 123, y
consider this simple function def foo(l=[]): if not l: print List is empty else
Consider this simple example - public class Person { private String name; private Date
Consider the following two methods, written in pseudo code, that fetches a complex data
Consider these pseudo models: class City(models.Model): name = models.CharField() region = models.ForeignKey(Region) class Region(models.Model):
Consider these pseudo models: class Category(models.Model): name = models.CharField() class Product(models.Model): name = models.CharField()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.