Skip to content
Loading
  
  •         class="right-box ">  
  •         
      
  •             

    FOOD FORM

      
  •   
  •   
  •   
  •      
  •   
  •        
  •   
  •   
  •   
  •   
  •           
  •   
  •   
  •   
  •   
  •   
  •   
  •   
  •   
  •   
  •   
  •             
  •   
  •           
  •           
  •           
  •         class="clearfix">  
  •       
  •  The CSS
    1. table,th,td {  
    2.     border:1px solid black;  
    3.     width:30%;  
    4.       
    5.     position:left;  
    6.     background-color:orange;  
    7.     font-style:italic;  
    8.     }  
    9.     h1{  
    10.     font-style:bold italic;  
    11.     }  
    12.     form{  
    13.     position:relative;  
    14.     top:0;  
    15.     background-color:orange;  
    16.     font-style:italic;  
    17.     }  
    18.     .bg-light{  
    19.       background: #c2c8ca;  
    20.     }  
    21.     .clearfix{  
    22.       clear: both;  
    23.     }  
    24.     .test-height{  
    25.       height: 100px;  
    26.     }  
    27.     .container{  
    28.       width:95%;  
    29.       margin: 0 auto;  
    30.     }  
    31.       
    32.     .container-fullwidth{  
    33.       width: 100%;  
    34.     }  
    35.     .left-box, .right-box{  
    36.       width: 50%;  
    37.       float: left;  
    38.     }  
    39.       
    40.     .right-box{  
    41.       width: 50%;  
    42.       float:right;  
    43.     }  
    44.   
    45.     @media screen and (max-width:768px){  
    46.       .left-box, .right-box{  
    47.         width: 100%;  
    48.       }  
    49.         
    50.     }  
    51.     .md1 p1{  
    52.     font-size:50px;  
    53.     align:left;  
    54.     }  
    55.     .md2 p2{  
    56.     font-size:50px;  
    57.     text-align:right;  
    58.     }  
    59. #show th,#show td{  
    60. padding:5px;  
    61. }  
    62.     
    and script
    1. $("#btn").click(function()  
    2. {  
    3. var userName=$("#uname").val();  
    4. var qty=$('input[name="rdoQty"]:checked').val();  
    5. var CP=$('input[name="rdocombo"]:checked').val();  
    6. var beverages=$("#bv").text();  
    7. var comments= $("#tx").val();  
    8. alert(userName+""+qty+""+CP+""+beverages+""+comments);  
    9. var tr=document.createElement("tr");  
    10. $(tr).append("
    ").append("").append("").append("").append("");  
  • $("#show").append(tr);  
  • });  
  •  
    +1
  • +1
    i need a form validation like there should not take repeated values,it should have alert message and should have the validation like textbox should not exceed 8 characters and should take only string. Also needed the loop of single array declaration in the javascript without usingle 5 array.
    +1
  • +1

    @sachin singh, I need form validation for your code as there should not accept any duplicate values in all the fields and textbox should not exceed more than 8 characters and contain only strings.

    +1
  •   
  •           for"uname">Enter item name:  
  •       
  •   
  • "text" name="username" id="uname">
  •   
  •   
  •   
  •             "radio" name="rdoQty" value="1">1  
  •   
  •             "radio"  name="rdoQty"value="2">2  
  •   
  •             "radio" name="rdoQty"value="3">3  
  •   
  •   
  •   
  •   
  •             "radio"  name="rdocombo"  value="Italian combo">Italian combo
      
  •             "radio"  name="rdocombo"  value="seafood combo">seafood combo
  •   
  • for="beverages">Beverages  
  •   
  • "bv" name="beverages">--select any one--  
  • "0">Beverages  
  • "1">cooldrinks  
  • "2">icecream  
  • "3">mocktails  
  •   
  •   
  •   
  •                  
  •             "tx">  

  •   
  •   
  •                   
  •                "button" name="submit" id="btn" value="submit">
  • "+userName+""+qty+""+CP+""+beverages+""+comments+"