Why 'status-box', but not 'form-control'?


The question has bothered me since last night!

It's in 3. Create a new post

I have been aware a space between class=" " means there are two classes, so in the html code: , there are class: form-control and class: status-box.
But why do you select class 'status-box' to store the content in the textarea, but not 'form-control' ?
Are there any additional codes that function 'status-box'? For example, in some other css files?

Thanks a lot!


Hey Ryoringo,

Good question :slight_smile:

There are two reasons that come to my mind.

  1. The form-control class is part of Bootstrap, a CSS framework which has a lot of styles pre-coded for you - you plug it in and customize a few things so your site doesn't look too common, and everything looks great! (exaggerated simplicity). The form-control class is only meant to be used for styling forms, not for JavaScript functionality with them or anything. And since .form-control is used for styling forms, if there happened to be two forms on a page for some reason, both with the form-control class, then our code would let either form submit a “status”, even if one of the forms was meant for a different purpose.
  2. It's just part of choosing appropriate names for things. For example, we use the variable charactersLeft in our code, not something like "a". Imagine maintaining a several hundred line-long program with variable names like that - it would quickly get pretty hard to understand the code.

Those are the two reasons I think of right off :slight_smile:


Got it! Very clear explanation. Thank you very much!


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.