123

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.

            
              <header>
  <h1>Напишите нам</h1>
  <p>Мы ждём ваших предложений по заметкам и заявок на рекламу</p>
  <hr>
</header>
<main>
  <form name='contact_form' method="post" enctype="multipart/form-data" onsubmit="return validateForm()">
    <fieldset class="form-group">
<!--       <legend>
        Personal details
      </legend> -->
      <div class='form-row'>
        <div class="col-md-3">
          <label for="choose_title">Пол</label>
          <div class="form-check">
            <input class="form-check-input" type="radio" name="choose_title" id="exampleRadios1" value="male" checked>
            <label class="form-check-label" for="exampleRadios1">
              Муж.
            </label>
          </div>
          <div class="form-check">
            <input class="form-check-input" type="radio" name="choose_title" id="exampleRadios2" value="female">
            <label class="form-check-label" for="exampleRadios2">
              Жен.
            </label>
          </div>
        </div><!-- .col-md-4 -->
        <div class="col-md-4 mb-3">
          <label for="first_name">Имя</label>
          <input name='first_name' type="text" maxchars="70" id="first_name" value="" class="form-control" placeholder='Иван'>
          <div class="invalid-feedback">
            Please provide your First Name.
          </div>
        </div><!-- .col-md-4 -->
        <div class="col-md-4 mb-3">
          <label for="last_name">Фамилия</label>
          <input name='last_name' type="text" maxchars="70" id="last_name" value="" class="form-control" placeholder='Иванов'>
          <div class="invalid-feedback">
            Please provide your Last Name.
          </div>
        </div><!-- .col-md-4 -->
      </div><!-- .form-row -->
      </fieldset>
      <fieldset class="form-group">
<!--           <legend>Contact details</legend> -->
          <label for="form-email">Email адрес <b>*</b></label>
          <br>
          <input name='email' type="email" placeholder="name@yandex.ru" required="" maxchars="70" id="form-email" value=""
                 class="form-control">
        <div class="invalid-feedback">
            Пожалуйста, введите точный email адрес, например: name@yandex.ru.
          </div>

      </fieldset>
      <fieldset class="form-group">
<!--           <legend>Address</legend> -->
        <label for="form-country">Страна <b>*</b></label>
          <br>
          <select name='country' required="" id="form-country" class="form-control">
              <option value="0" class="label">Выберите (на английском)</option>
              <option value="96">Afghanistan</option>
              <option value="377">Albania</option>
              <option value="1">Algeria</option>
              <option value="300">American Samoa</option>
              <option value="336">Andorra</option>
              <option value="60">Angola</option>
              <option value="104">Anguilla</option>
              <option value="198">Antarctica</option>
              <option value="105">Antigua and Barbuda</option>
              <option value="106">Argentina</option>
              <option value="251">Armenia</option>
              <option value="107">Aruba</option>
              <option value="301">Australia</option>
              <option value="4">Austria</option>
              <option value="222">Azerbaijan</option>
              <option value="108">Bahamas</option>
              <option value="231">Bahrain</option>
              <option value="199">Bangladesh</option>
              <option value="109">Barbados</option>
              <option value="391">Belarus</option>
              <option value="341">Belgium</option>
              <option value="110">Belize</option>
              <option value="2">Benin</option>
              <option value="111">Bermuda</option>
              <option value="200">Bhutan</option>
              <option value="112">Bolivia</option>
              <option value="378">Bosnia and Herzegovina</option>
              <option value="21">Botswana</option>
              <option value="59">Bouvet Island</option>
              <option value="99">Brazil</option>
              <option value="302">British Indian Ocean Territory</option>
              <option value="101">British Virgin Islands</option>
              <option value="201">Brunei Darussalam</option>
              <option value="376">Bulgaria</option>
              <option value="3">Burkina-Faso</option>
              <option value="22">Burundi</option>
              <option value="203">Cambodia</option>
              <option value="7">Cameroon</option>
              <option value="150">Canada</option>
              <option value="28">Cape Verde</option>
              <option value="128">Cayman Islands</option>
              <option value="58">Central African Republic</option>
              <option value="15">Chad</option>
              <option value="98">Chile</option>
              <option value="220">China</option>
              <option value="325">Christmas Island</option>
              <option value="239">Cocos Islands</option>
              <option value="129">Colombia</option>
              <option value="30">Comoros</option>
              <option value="31">Congo, Democratic Republic of the</option>
              <option value="8">Congo, Republik of the</option>
              <option value="303">Cook Islands</option>
              <option value="115">Costa Rica</option>
              <option value="380">Croatia</option>
              <option value="130">Cuba</option>
              <option value="364">Cyprus</option>
              <option value="349">Czech Republic</option>
              <option value="351">Denmark</option>
              <option value="23">Djibouti</option>
              <option value="116">Dominica</option>
              <option value="117">Dominican Republic</option>
              <option value="317">East Timor</option>
              <option value="149">Ecuador</option>
              <option value="17">Egypt</option>
              <option value="118">El Salvador</option>
              <option value="19">Equatorial Guinea</option>
              <option value="24">Eritrea</option>
              <option value="357">Estonia</option>
              <option value="20">Ethiopia</option>
              <option value="119">Falkland Islands</option>
              <option value="352">Faroe Islands</option>
              <option value="304">Fiji</option>
              <option value="366">Finland</option>
              <option value="356">France</option>
              <option value="120">French Guiana</option>
              <option value="305">French Polynesia</option>
              <option value="306">French Southern and Antarctic Lands</option>
              <option value="5">Gabon</option>
              <option value="6">Gambia</option>
              <option value="467">Gaza</option>
              <option value="253">Georgia</option>
              <option value="326">Germany</option>
              <option value="25">Ghana</option>
              <option value="338">Gibraltar</option>
              <option value="334">Greece</option>
              <option value="97">Greenland</option>
              <option value="121">Grenada</option>
              <option value="122">Guadeloupe</option>
              <option value="102">Guam</option>
              <option value="123">Guatemala</option>
              <option value="26">Guinea</option>
              <option value="27">Guinea-Bissau</option>
              <option value="124">Guyana</option>
              <option value="125">Haiti</option>
              <option value="307">Heard Island and McDonald Islands</option>
              <option value="126">Honduras</option>
              <option value="233">Hong Kong</option>
              <option value="390">Hungary</option>
              <option value="345">Iceland</option>
              <option value="218">India</option>
              <option value="202">Indonesia</option>
              <option value="250">Iran</option>
              <option value="234">Iraq</option>
              <option value="344">Ireland</option>
              <option value="235">Israel</option>
              <option value="431">Italy</option>
              <option value="465">Ivory Coast</option>
              <option value="127">Jamaica</option>
              <option value="236">Japan</option>
              <option value="237">Jordan</option>
              <option value="358">Jugoslavia</option>
              <option value="254">Kazakhstan</option>
              <option value="29">Kenya</option>
              <option value="308">Kiribati</option>
              <option value="240">Kuwait</option>
              <option value="255">Kyrgyzstan</option>
              <option value="204">LAO People's Democratic Republic</option>
              <option value="359">Latvia</option>
              <option value="33">Lebanon</option>
              <option value="32">Lesotho</option>
              <option value="34">Liberia</option>
              <option value="35">Libya</option>
              <option value="360">Liechtenstein</option>
              <option value="373">Lithuania</option>
              <option value="361">Luxembourg</option>
              <option value="241">Macao</option>
              <option value="381">Macedonia</option>
              <option value="36">Madagascar</option>
              <option value="37">Malawi</option>
              <option value="205">Malaysia</option>
              <option value="206">Maldives</option>
              <option value="9">Mali</option>
              <option value="362">Malta</option>
              <option value="309">Marshall Islands</option>
              <option value="131">Martinique</option>
              <option value="11">Mauritania</option>
              <option value="38">Mauritius</option>
              <option value="468">Mayotte</option>
              <option value="132">Mexico</option>
              <option value="310">Micronesia</option>
              <option value="242">Midway Islands</option>
              <option value="355">Moldova</option>
              <option value="363">Monaco</option>
              <option value="243">Mongolia</option>
              <option value="133">Montserrat</option>
              <option value="10">Morocco</option>
              <option value="39">Mozambique</option>
              <option value="207">Myanmar</option>
              <option value="40">Namibia</option>
              <option value="311">Nauru</option>
              <option value="208">Nepal</option>
              <option value="342">Netherlands</option>
              <option value="135">Netherlands Antilles</option>
              <option value="312">New Caledonia</option>
              <option value="313">New Zealand</option>
              <option value="134">Nicaragua</option>
              <option value="12">Niger</option>
              <option value="18">Nigeria</option>
              <option value="314">Niue-Islands</option>
              <option value="316">Norfolk Islands</option>
              <option value="209">North Korea</option>
              <option value="315">Northern Mariana Islands</option>
              <option value="346">Norway</option>
              <option value="244">Oman</option>
              <option value="228">Pakistan</option>
              <option value="318">Palau</option>
              <option value="136">Panama</option>
              <option value="319">Papua New Guinea</option>
              <option value="137">Paraguay</option>
              <option value="138">Peru</option>
              <option value="210">Philippines</option>
              <option value="245">Pitcairn</option>
              <option value="424">Poland</option>
              <option value="337">Portugal</option>
              <option value="139">Puerto Rico</option>
              <option value="238">Qatar</option>
              <option value="471">Republic of South Sudan</option>
              <option value="384">Romania</option>
              <option value="249">Russian Federation</option>
              <option value="41">Rwanda</option>
              <option value="469">Réunion</option>
              <option value="48">Saint Helena</option>
              <option value="140">Saint Kitts and Nevis</option>
              <option value="141">Saint Lucia</option>
              <option value="142">Saint Pierre and Miquelon</option>
              <option value="143">Saint Vincent and the Grenadines</option>
              <option value="321">Samoa</option>
              <option value="374">San Marino</option>
              <option value="221">Saudi Arabia</option>
              <option value="13">Senegal</option>
              <option value="385">Serbia and Montenegro</option>
              <option value="44">Seychelles</option>
              <option value="45">Sierra Leone</option>
              <option value="211">Singapore</option>
              <option value="348">Slovakia</option>
              <option value="387">Slovenia</option>
              <option value="320">Solomon Islands</option>
              <option value="47">Somalia</option>
              <option value="49">South Africa</option>
              <option value="144">South Georgia and the South Sandwich Islands</option>
              <option value="213">South Korea</option>
              <option value="339">Spain</option>
              <option value="212">Sri Lanka</option>
              <option value="50">Sudan</option>
              <option value="214">Suriname</option>
              <option value="51">Swaziland</option>
              <option value="340">Sweden</option>
              <option value="365">Switzerland</option>
              <option value="223">Syrian Arab Republic</option>
              <option value="43">Sâo Tomé and Principe</option>
              <option value="215">Taiwan</option>
              <option value="257">Tajikistan</option>
              <option value="52">Tanzania</option>
              <option value="216">Thailand</option>
              <option value="14">Togo</option>
              <option value="322">Tokelau</option>
              <option value="323">Tonga</option>
              <option value="145">Trinidad and Tobago</option>
              <option value="16">Tunisia</option>
              <option value="347">Turkey</option>
              <option value="224">Turkmenistan</option>
              <option value="146">Turks and Caicos Islands</option>
              <option value="246">Tuvalu</option>
              <option value="53">Uganda</option>
              <option value="389">Ukraine</option>
              <option value="247">United Arab Emirates</option>
              <option value="343">United Kingdom</option>
              <option value="100">United States Virgin Islands</option>
              <option value="103">United States of America</option>
              <option value="147">Uruguay</option>
              <option value="225">Uzbekistan</option>
              <option value="324">Vanuatu</option>
              <option value="375">Vatican City / Holy See</option>
              <option value="148">Venezuela</option>
              <option value="217">Vietnam</option>
              <option value="248">Wallis and Futuna</option>
              <option value="470">West Bank</option>
              <option value="54">Western Sahara</option>
              <option value="226">Yemen</option>
              <option value="42">Zambia</option>
              <option value="46">Zimbabwe</option>
          </select>
        <div class="invalid-feedback">
            Пожалуйста, выберите страну.
          </div>
      </fieldset>

      <fieldset class="form-group">
<!--           <legend>Send</legend> -->
          <div class="alert alert-warning" role="alert">
            <h3>We are sorry</h3>
            We cannot handle requests now. Please come back later.
          </div>
        <div id='not_valid' class="alert alert-secondary" role="alert">
              Пожалуйста, заполните все обязательные поля
          </div>
        <div class="alert alert-danger" role="alert">
              We cannot handle your request now, but we have saved it and will send it as soon as possible!
          </div>
        <div id='success' class="alert alert-success" role="alert">
              Ваше письмо успешно отправлено!
          </div>
          <button name='send' type="button" class="btn btn-lg btn-primary btn-block">Отправить</button>
      </fieldset>
    <p class='under_send'><b>*</b> - обязательное поле. Заполните его, чтобы мы могли с вами связаться.</p>
  </form>
</main>
<footer>
  <hr>
  <h3>Наши контакты</h3>
  <p>Другие способы связи:</p>
  <div class='row'>
    <div class='col'>
      <p>Иван Иванов:<br>
        <a href='https://vk.com/id0' target='_blank' rel='noopener'>ВК</a> | <a href='https://fb.com/' target='_blank' rel='noopener'>FB</a>
      </p>
    </div>
    <div class='col'>
      <p>Тел: <a href='tel:+99566545648' target='_blank' rel='noopener'>+7 (956) 654 56-48</a><br>
        Email адрес: <a href='mailto:index@yandex.ru' target='_blank' rel='noopener'>index@yandex.ru</a></p>
    </div>
    <div class='col'>
      <p>119021,<br>
        Москва,<br>
        ул. Льва Толстого, 16<br>
        <a href='https://osm.org/go/0t2amCnMn--' target='_blank' rel='noopener'>[на карте]</a>
      </p>
    </div>
  </div>
</footer>
            
          
!
            
              header, footer{
  width: 100%;
  max-width: 430px;
  padding: 15px;
  margin: 0 auto;
  text-align: center;
}
footer{
  max-width: 500px;
}
footer .col{
  text-align: left;
}
main{
  width: 100%;
  max-width: 330px;
  padding: 15px;
  margin: 0 auto;
}
.form-group b, .under_send b{
  color:red;
}
.under_send{
  font-style:italic;
  font-size: 0.8em;
}
.alert-warning h3{
  text-align: center;
}
.alert{
  display: none;
}
            
          
!
            
              var buttonList = document.getElementsByTagName('button');
buttonList[0].addEventListener('click', function(){
  /* Validation code start */
  // variables
  var title       = document.forms['contact_form']['choose_title'];
  var first_name  = document.forms['contact_form']['first_name'];
  var last_name   = document.forms['contact_form']['last_name'];
  var email       = document.forms['contact_form']['email'];
  var country     = document.forms['contact_form']['country'];
  var send        = document.forms['contact_form']['send'];
  var validForm = true;
  
//   if (title.value === "" || title.value === '0') {
//     if(!title.classList.contains('is-invalid'))
//       title.classList.add('is-invalid');    
//     validForm = false;
//   }
//   else{
//     if(!title.classList.contains('is-valid'))
//       title.classList.add('is-valid');
//     if(title.classList.contains('is-invalid'))
//       title.classList.remove('is-invalid');
//   }
  
//   if (first_name.value == "") {
//     if(!first_name.classList.contains('is-invalid'))
//       first_name.classList.add('is-invalid');    
//     validForm = false;
//   }
//   else{
//     if(!first_name.classList.contains('is-valid'))
//       first_name.classList.add('is-valid');
//     if(first_name.classList.contains('is-invalid'))
//       first_name.classList.remove('is-invalid');
//   }
  
//   if (last_name.value == "") {
//     if(!last_name.classList.contains('is-invalid'))
//       last_name.classList.add('is-invalid');    
//     validForm = false;
//   }else{
//     if(!last_name.classList.contains('is-valid'))
//       last_name.classList.add('is-valid');
//     if(last_name.classList.contains('is-invalid'))
//       last_name.classList.remove('is-invalid');
//   }
  
  // special email validation
  var validateEmail = /\S+@\S+\.\S+/;
  if (email.value == "" || !validateEmail.test(String(email.value).toLowerCase())) {
    if(!email.classList.contains('is-invalid'))
      email.classList.add('is-invalid');    
    validForm = false;
  }
  else{
    if(!email.classList.contains('is-valid'))
      email.classList.add('is-valid');
    if(email.classList.contains('is-invalid'))
      email.classList.remove('is-invalid');
  }
  
  if (country.value === "" || country.value === '0') {
    if(!country.classList.contains('is-invalid'))
      country.classList.add('is-invalid');    
    validForm = false;
  }
  else{
    if(!country.classList.contains('is-valid'))
      country.classList.add('is-valid');
    if(country.classList.contains('is-invalid'))
      country.classList.remove('is-invalid');
  }
  
  // check validForm status and show an error
  document.getElementById('not_valid').style.display = 'none';
  document.getElementById('success').style.display = 'none';
  if(validForm == false){
    document.getElementById('not_valid').style.display = 'block';
  }
  else{
    document.getElementById('success').style.display = 'block';
  }
  /* Validation code finish */
}, false);

            
          
!
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.

Console