Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>


<div class="wrap">
<form method="post" action="" name="myForm">
            <label class="label-top-border">
            <dl class="form-insert">
              <dt><span class="your-form">お名前</span><span id="errow_name" style="color:red;"></span></dt>
              <dd><input type="text" value="" name="cst_name" id="your_name"></dd>
            </dl>
            <dl class="form-insert">
              <dt><span class="your-form">関心のある項目(複数選択可)</span><span id="errow_favorite" style="color:red;"></span></dt>
              <dd><input type="checkbox" value="経済" name="your_favorite[]" class="your_favorite">経済</dd>
              <dd><input type="checkbox" value="政治" name="your_favorite[]" class="your_favorite">政治</dd>
              <dd><input type="checkbox" value="哲学" name="your_favorite[]" class="your_favorite">哲学</dd>
              <dd><input type="checkbox" value="語学" name="your_favorite[]" class="your_favorite">語学</dd>
              <dd><input type="checkbox" value="" name="your_favorite[]" class="your_favorite" checked style="display:none;"></dd>
            </dl>
            <dl class="form-insert">
              <dt><span class="your-form">年齢</span><span id="errow_old" style="color:red;"></span></dt>
              <dd><input type="radio" value="10代" name="cst_old" id="your_old">10代</dd>
              <dd><input type="radio" value="20代" name="cst_old" id="your_old">20代</dd>
              <dd><input type="radio" value="30代" name="cst_old" id="your_old">30代</dd>
              <dd><input type="radio" value="40代" name="cst_old" id="your_old">40代</dd>
              <dd><input type="radio" value="" name="cst_old" id="your_old" checked style="display:none;"></dd>
            </dl>
            <dl class="form-insert">
              <dt><span class="your-form">メール</span><span id="errow_mail" style="color:red;"></span></dt>
              <dd><input type="text" value="" name="cst_mail" id="your_mail"></dd>
            </dl>
            <dl class="form-insert">
              <dt><span class="your-form">連絡先</span><span id="errow_tel" style="color:red;"></span></dt>
              <dd><input type="text" value="" name="cst_tel" id="your_tel"></dd>
            </dl>
            <dl class="form-insert">
              <dt><span class="your-form">住 所</span><span id="errow_adr" style="color:red;"></span></dt>
              <dd><input type="text" value="" name="cst_adr" id="your_adr"></dd>
            </dl>
            <dl class="form-insert">
              <dt>その他</dt>
              <dd><textarea name="info"></textarea></dd>
            </dl>
            </label>
             <p class="center">
               <label><input type="checkbox" value="1" name="ply_val" id="ply_val">下記、個人情報の取扱いに同意します<span id="errow_ply" style="color:red;"></span></label>
             </p>
             <input type="button" value="送信" id='submit_id' />
           </form>
</div>
              
            
!

CSS

              
                .wrap{
  width:800px;
  margin:0 auto;
}
              
            
!

JS

              
                  //チェックボックス
          function check_regist_form(){

          	//イベントタイトル
          	//var name = document.contact_form.cst_name.value;
          	var name = $("#your_name").val();
          	//if(name ==""){ alert("お名前をご記入ください");return false;}
            if(name ==""){ document.getElementById("errow_name").innerHTML="お名前をご記入ください";return false;}

            //var old = $("#your_old").val();
            //var old =document.myform.elements['cst_old[]'];
            //var old =$('input[name="cst_old[0]"]').val();
            var your_favorite =$('[class="your_favorite"]:checked').val();
            if(your_favorite ==""){ document.getElementById("errow_favorite").innerHTML="項目を選択してください";return false;}

            //alert(old);

            //var old =$("[name=cst_old]:checked").val();
            var old =$("[name=cst_old]:checked").val();
            if(old ==""){ document.getElementById("errow_old").innerHTML="年齢を選択してください";return false;}


          	//var mail = document.contact_form.cst_mail.value;
          	var mail = $("#your_mail").val();
          	if(mail ==""){
              document.getElementById("errow_mail").innerHTML="メールアドレスを入力してください";return false;
            }else if(!mail.match(/\S+@\S+\.\S+/)){ // Jaymon's / Squirtle's solution
              // Do something
              document.getElementById("errow_mail").innerHTML="メールアドレスを正しく入力してください";
              return false;
            }else if( mail.indexOf(' ')!=-1 || mail.indexOf('..')!=-1){
              // Do something
              document.getElementById("errow_mail").innerHTML="メールアドレスを正しく入力してください";
              return false;
            }

          	var tel = $("#your_tel").val();
          	if(tel ==""){ document.getElementById("errow_tel").innerHTML="電話番号を入力してください";return false;}

          	var adr = $("#your_adr").val();
          	if(adr ==""){ document.getElementById("errow_adr").innerHTML="住所を入力してください";return false;}

          	var ply = $("[name=ply_val]:checked").val();
          	if(ply !=="1"){ document.getElementById("errow_ply").innerHTML="個人情報取り扱いに同意してください";return false;}
          	return true;
          }



          $(function(){
          	$("#submit_id").click(function(){
            //初期値に戻す
            document.getElementById("errow_name").innerHTML="";
            document.getElementById("errow_favorite").innerHTML="";
            document.getElementById("errow_old").innerHTML="";
            document.getElementById("errow_mail").innerHTML="";
            document.getElementById("errow_tel").innerHTML="";
            document.getElementById("errow_adr").innerHTML="";
            document.getElementById("errow_ply").innerHTML="";

          	if(check_regist_form() === true){
              var $form = $('form[name="myForm"]');
          			$form.submit();
          		}
          	});
          });
              
            
!
999px

Console