Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to read textbox values from html and insert them into tables using java script

how to read html texbox values and insert them into databaase table
Comment

add textbox data to table html and javascript

$(function() {
  $('form[name="registration"]').submit(function(e) {
    e.preventDefault();
    var name  = $('input[name="name"]').val(),
        sName = $('input[name="surname"]').val(),
        cnp   = $('input[name="cnp"]').val(),
        age   = $('input[name="age"]').val(),
        ocu   = $('select[name="ocupatia"]').val();

   if($('.results').length < 1) {
      $('body').append('<table class="results">'
                        +'<tr>'
                          +'<th>Nume</th>'
                          +'<th>Prenume</th>'
                          +'<th>CNP</th>'
                          +'<th>Varsta</th>'
                          +'<th>Ocupatia</th>'
                        +'</tr>'
                        +'<tr>' 
                          +'<td>'+name+'</td>'
                          +'<td>'+sName+'</td>'
                          +'<td>'+cnp+'</td>'
                          +'<td>'+age+'</td>'
                          +'<td>'+ocu+'</td>'
                        +'</tr>'
                     + '</table>');
   }

  });

});
Comment

PREVIOUS NEXT
Code Example
Javascript :: basic routes 
Javascript :: nyaapi node 
Javascript :: how we pass 2 args in switch case javascript 
Javascript :: min expression postgresql 
Javascript :: action creators in redux 
Javascript :: typeorm sqlite Using Entity Manager 
Javascript :: typeorm caching queries time limit 
Javascript :: twitter user profile regex javascript 
Javascript :: react get padding 
Javascript :: last iteration is for loop js ES6 
Javascript :: angular crud rest api medium 
Javascript :: js array random find 
Javascript :: api call in react chart 
Javascript :: Mapping page number to index 
Javascript :: Classes and constructor functions in ES6 
Javascript :: selected item from dropdownlist 
Javascript :: let a local variable 
Javascript :: send offer webrtc 
Javascript :: nodejs mongoose connec tion 
Javascript :: js shufflin 
Javascript :: jsx tag with children react js 
Javascript :: how i change background of row in javascript jquery 
Javascript :: video js ajax 
Javascript :: give multiple class and id for each owl carousel function 
Javascript :: Refresh Mathjax formater 
Javascript :: js function to print words on number 
Javascript :: define classname next with more than one name 
Javascript :: likedislike 
Javascript :: catch the last item in a array js 
Javascript :: alpiee js hide amother button click 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =