Add more Input box using javascript

function addvalue(){ var products=””; var i=$(“#tblproduct tr”).size(); var j=0; var str=””; var k=0; for(j=1;j<=i;j++) { proval=""; proqty=""; if($("#txtpro"+j).val()!='0' && $("#qty"+j).val()!='') { str+="&pro"+j+"="+$("#txtpro"+j).val()+"&qty"+j+"="+$("#qty"+j).val(); k++; } } alert(str); /* $.ajax({ type: 'POST', url: "data.php?id="+i+'&str='+str, data: {}, success: function(data){ alert(data); } }); */ } function btnclickadd() { var i = $('#tblproduct tr').size() +1; $(".addmore").hide(); $('#myid').val(i); var x="”; x=x.replace(‘txtpro1’,’txtpro’+i).replace(‘txtpro1’,’txtpro’+i); $(‘

Product: ‘+x+’ Quantity: Add More

‘).appendTo(‘#tblproduct’); return false; }

Product: Quantity: Add More

only number key in javascript

function IsNumber(evt,x) { var charCode = (evt.which) ? evt.which : event.keyCode ; //alert(charCode); if(charCode != 46 && charCode != 45){ // . = 46 , – = 45 if ((charCode > 31 && (charCode 57)) ) return false; //alert($(‘#txtts’).val()); var s= $(x).val().split(‘.’) ; if(s[1].length > 1){ return false ;}; return true; }else if(charCode==45){ if($(x).val().length!=0) return false ; } if(charCode==46){ if($(x).val().indexOf(‘.’)!=’-1′){ return false ;}; } var s= $(x).val().split(‘.’) ; if(s[1].length > 1){ return false ;}; return true; }

function IsNumber(evt,x)
 {

         var charCode = (evt.which) ? evt.which : event.keyCode ; //alert(charCode);

if(charCode != 46 && charCode != 45){ // . = 46 , – = 45
         if ((charCode > 31 && (charCode 57)) )
            return false;
//alert($(‘#txtts’).val());
var s= $(x).val().split(‘.’) ; if(s[1].length > 1){ return false ;};
         return true;
}else
if(charCode==45){ if($(x).val().length!=0) return false ; }

 if(charCode==46){
 if($(x).val().indexOf(‘.’)!=’-1′){ return false ;};
 }

var s= $(x).val().split(‘.’) ; if(s[1].length > 1){ return false ;};
return true;
      }

 
 

Javascript method


//////////////////////////////// ajaxFileUpload Method for uploding File ??????????????????????????????????????????
$.ajaxFileUpload
(
{
url:’Ajax/uploadimage.php’,
secureuri:false,
fileElementId:’txtfile’,  // input type = file , name = ‘txtfile’

data:{“albumid”:$(“#id”).val(),”txtimgtitle”:$(“#txtimgtitle”).val()},
success: function (data1, status)
{
                      alert(data1);
                 
},
error: function (data, status, e)
{
alert(e);
}
}
);

//////////////////////////////// LOAD Method ??????????????????????????????????????????

function start()
{
var url = “Ajax/loadpage.php?stext=”+$(“#txtstext”).val().replace(/^\s+|\s+$/g,””).replace(/\s/g,”~@@~”).replace(/&/g,”%26″) + ‘&ddlsschemetype=’+$(‘#ddlsschemetype’).val();
showload(“#loaddata”);
$(“#loaddata”).load(url,{},function (responseText, textStatus, XMLHttpRequest) {

alert(responseText);

});
}
//////////////////////////////// POST Method ??????????????????????????????????????????

$.ajax({
  type: ‘POST’,
  url: “Ajax/delete.php?typ=miniority”,
  data: { ‘name=’+ $(‘#name’).val() + ‘&email=’ + $(‘#email’).val() ; },
  success: function(data12){
//alert(data12);

  }});

check uncheck all check box using javascript and jquery

function selectallCHBox(){ if($(‘#selectall’).attr(‘checked’)){var inputs = document.getElementsByClassName(‘chechid’);var checkboxes = [];for (var i = 0; i < inputs.length; i++) { if (inputs[i].type == 'checkbox') {inputs[i].checked =true; } } }else { var inputs = document.getElementsByClassName('chechid');var checkboxes = [];for (var i = 0; i < inputs.length; i++) { if (inputs[i].type == 'checkbox') {inputs[i].checked =false; } }}}
Your ckname are
name 1
name 2
name 3
name 4
name 5
name 6

Select / Unselect All

function selectallCHBox(){

if($(‘#selectall’).attr(‘checked’)){
var inputs = document.getElementsByClassName(‘chechid’);
var checkboxes = [];
for (var i = 0; i < inputs.length; i++) {

  if (inputs[i].type == ‘checkbox’) {
inputs[i].checked =true; } }
}
else {
var inputs = document.getElementsByClassName(‘chechid’);
var checkboxes = [];
for (var i = 0; i < inputs.length; i++) {

  if (inputs[i].type == ‘checkbox’) {
inputs[i].checked =false; } }

}

}

Your ckname are

name 1

name 2

name 3

name 4

name 5

name 6

Select / Unselect All

Check Box Validation In javascript

function validate(){var chksob = document.getElementsByName(‘ckname[]’);var checkchecked = false;for (var i = 0; i < chksob.length; i++){if (chksob[i].checked){checkchecked = true;break;}}if (checkchecked == false){alert("Please select at least one Name .");return false;}return true;}
Your ckname are
name 1
name 2
name 3
name 4
name 5
name 6

function validate()
{
var chksob = document.getElementsByName(‘ckname[]’);
var checkchecked = false;
for (var i = 0; i < chksob.length; i++)
{
if (chksob[i].checked)
{
checkchecked = true;
break;
}
}
if (checkchecked == false)
{
alert(“Please select at least one Name .”);
return false;
}
return true;
}

Your ckname are

name 1

name 2

name 3

name 4

name 5

name 6