css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<header>
  <div class='for-header'>
    <h1>Create new test</h1>
    <p>All changes are saved</p>
  </div>
</header>
<section class="main">
  <div>
    <input class='test-name' value="Test name" type="text">
    </br>
    <input class='descr' placeholder="Description" type="text">
  </div>
  <div class="div-question">
    <input class='
 question' type="text" value="What is your favourite color?">

    <input type="radio" name="question1" value="Red" id="red">
    <input class='
 answer' type='text' value="Red">
    </br>
    <input type="radio" name="question1" value="Blue" id="blue">
    <input class='
 answer' type='text' value='Blue'>
    </br>
    <input type="radio" name="question1" value="Pink" id="pink">
    <input class='
 answer' type='text' value='Pink'>
    </br>
    <input type="radio" name="question1" value="Black" id="black">
    <input class='
 answer' type='text' value='Black'>
    </br>
    <input type="radio" name="question1" value="Green" id="green">
    <input class='
 answer' type='text' value='Green'>
    </br>
    <input type="radio" name="question1" value="Yellow" id="yellow">
    <input class='
 answer' type='text' value='Yellow'>
    </br>
    <input type='radio' name='question1'>
    <input class='answer add' type='text' placeholder="Add value" data-value='1'>

  </div>
  <div class="div-question">
    <input class='
 question' type="text" value="What is your favourite color?">
    </br>

    <input type="radio" name="question2" value="Red" id="red">
    <input class='
 answer' type='text' value="Red">
    </br>
    <input type="radio" name="question2" value="Blue" id="blue">
    <input class='
 answer' type='text' value='Blue'>
    </br>
    <input type="radio" name="question2" value="Pink" id="pink">
    <input class='
 answer' type='text' value='Pink'>
    </br>
    <input type="radio" name="question2" value="Black" id="black">
    <input class='
 answer' type='text' value='Black'>
    </br>
    <input type="radio" name="question2" value="Green" id="green">
    <input class='
 answer' type='text' value='Green'>
    </br>
    <input type="radio" name="question2" value="Yellow" id="yellow">
    <input class='
 answer' type='text' value='Yellow'>
    </br>
    <input type='radio' id='add' name='question2'>
    <input class='answer add' type='text' placeholder="Add value" data-value='2'>

  </div>

</section>
<aside>
<button class='create'>Create question</button>
<button class='delete'>Delete test</button>
</aside>
            
          
!
            
              body 
  margin: 0px
  font-family: 'Roboto', sans-serif
  background-color: #e7e7e7

  header 
    width: 100%
    height: 35vh
    background-color: #039e4f
    color: white
    margin: 0
    text-align: center
    font-size: 3vh
    h1 
      margin: 0
      padding-top: 7.5vh

  .main 
    padding-left: 4%
    padding-right: 4%
    position: relative
    background-color: white
    width: 66%
    margin: auto
    bottom: 13.5vh
    padding-bottom: 4%
    
    
    input[type='radio']
      margin-top: 1.5%
    input[type="text"] 
      border: none
      border-bottom: 1px solid #7e858b
      background-color: white
      margin-top: 2.1%
      outline: 0 
      margin-left: 1%
    .test-name
      width: 63.95vw
      height: 5vh
      font-size: 5vh
    .descr
      width: 63.95vw
      font-size: 1.9vh
    .question 
      width: 63.95vw
      font-size: 3.6vh
    .answer
      width: 62vw
      font-size: 2.4vh
    .div-question
      margin-top: 5vh
    input:focus
      border-bottom: 3px solid #039e4f
aside
  position: fixed
  bottom: 62vh
  left: 86vw
  
  
  
  
 
      
        
      

   

   


            
          
!
            
              var buttonCount = 3;
$(document).on('focus',':text', function(){
  $(this).parent().css('border-left', '3px solid #4d90fe');
    $('p').hide()
})
$(document).on('focusout', ':text', function(){
  $(this).parent().css('border-left', '');

    $.ajax({
      method: 'PUT',
      url: 'your server',
      data: $(this).val()
    }).done($('p').show())
})
$(document).on('keydown','.add', function(e){
    if (e.which === 13) {
      var data = this.dataset
  var value = $(this).val()
    var element = "<input class=' answer' type='text' value='" + value + "'>" + "</br><input type='radio' name='question" + data.value+"'>"
      $(this).before(element)
      $(this).val("")
    }
})
$('.create').on('click',function(){
  var element = "<div class='div-question'><input class='question' type='text' value='What is your favourite color?'></br><input type='radio' name='question" + buttonCount +"' value='Red'><input class='answer' type='text' value='Red'></br><input type='radio' id='add' name='question"+buttonCount +"'><input class='answer add' type='text' placeholder='Add value' data-value='" + buttonCount +"'</div>"
  $('.main').append(element)
  buttonCount++
})
$('.delete').on('click', function(){
  $.ajax({
    url: 'your server',
    type: 'DELETE',
    success: function(){
location.reload();}
  })
})
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console