Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="uex_config_panel" style="display: block;">
  <input id="count_field" type="hidden" value="0">
  <div class="uex_panel uex_options_input">
    <h3>Tipos de campos permitidos a adicionar</h3>
    <a id="text" class="uex_add_option">Add text</a>
    <a id="date" class="uex_add_option">Add date</a>
    <a id="select" class="uex_add_option">Add select</a>
    <a id="email" class="uex_add_option">Add email</a>
    <a id="password" class="uex_add_option">Add password</a>
  </div>
  <div class="uex_panel uex_set_input">
    <h3>Configurar campo extra</h3>
    <div id="config_field"></div>
    <a id="add_input" class="uex_set_option">Add</a>
  </div>
  <div class="uex_panel uex_view_inputs">
    <h3>Campos Extras</h3>
    <table class="form-table">
      <tbody id="fields">
        <tr class="saved">
          <th><label>Address</label></th>
          <td><input type="text"></td>
          <td><a id="remove_input" class="uex_remove_option">X</a></td>
        </tr>
      </tbody>
    </table>
  </div>
</div>
              
            
!

CSS

              
                /**
 * All of the CSS for your admin-specific functionality should be
 * included in this file.
 */

a{
  color: blue;
}

a.uex_config {
  cursor: hand !important;
  margin-left: 20px;
}

.uex_config_panel {
  width: 100%;
  min-height: 100px;
  border: 1px dotted black;
  display: none;
}

.uex_config_panel a {
  position: relative;
  margin: 0 5px;
  height: 30px;
  border-radius: 10px;
  padding: 5px;
  white-space: nowrap;
  cursor: hand !important;
  line-height: 35px;
}

a.uex_add_option {
  background: black;
}

a.uex_add_option:hover {
  background: rgb(47, 45, 45);
}

a.uex_set_option {
  background: green;
  color: white;
  width: 100%;
}

a.uex_set_option:hover {
  background: #36D036;
}

a.uex_remove_option {
  color: white;
  border-radius: 0;
}

tr.remove a.uex_remove_option {
  background: red;
}

tr.saved a.uex_remove_option {
  background: green;
}

tr.pending a.uex_remove_option {
  background: blue;
}

a.uex_remove_option:hover {
  background: red !important;
}

div.uex_panel {
  display: inline-block;
  padding: 15px;
  width: 27%;
  margin: 1%;
  min-height: 100px;
  vertical-align: top;
}
              
            
!

JS

              
                $(function() {
  $('.uex_config').click(function() {
    if ($(this).hasClass('uex_config_hide')) {
      $('.uex_config_panel').hide('slow');
      $(this).html('Config extra fields').removeClass('uex_config_hide');
    } else {
      $('.uex_config_panel').show('slow');
      $(this).html('hide').addClass('uex_config_hide');
    }
  });

  $('.uex_add_option').click(function() {
    var id = $(this).attr('id');
    var div = "Botão não implementado";
    if (id == 'text') {
      div = "<label>Name Field: </label><input id='name_field' type='text'/><br><label>Label Field: </label><input id='label_field' type='text'/><br><input id='type_field' type='hidden' value='text'>";
    }
    $('#config_field').append(div);
  });

  $('#add_input').click(function() {
    var count_field = $('#count_field').val();
    var type = $('#type_field').val();
    var field = '';
    if (type == 'text') {
      var label = $('#label_field').val();
      var name = $('#name_field').val();
      field = "<tr class='pending'><input id='field_name_" + count_field + "' type='hidden' value='" + name + "'><input id='field_label_" + count_field + "' type='hidden' value='" + label + "'><input id='field_type_" + count_field + "' type='hidden' value='" + type + "'><th><label>" + label + "</label></th><td><input class='field_type' type='text'/></td><td><a id='remove_input' class='uex_remove_option'>X</a></td></tr>";
      count_field++;
      $('#count_field').val(count_field);
      $('#config_field').html('');
    }
    $('#fields').append(field);

    $('#remove_input').on("click", function() {
      var count_field = $('#count_field').val();
      var parent_class = $(this).parents('tr');
      if (parent_class.hasClass('pending')) {
        parent_class.remove();
        count_field--;
      } else if (parent_class.hasClass('saved')) {
        parent_class.removeClass('saved').addClass('remove');
      }
      $('#count_field').val(count_field);
    });
  });
});
              
            
!
999px

Console