Search found 74 matches

by Lphp
Mon Sep 05, 2016 8:41 pm
Forum: Javascript
Topic: sum text field depend on the other drop down's value
Replies: 2
Views: 14306

Re: sum text field depend on the other drop down's value

i have two column i did not sum K1 , I sum every number relate to K1 and I have the sum define outside each
by Lphp
Mon Sep 05, 2016 9:49 am
Forum: Javascript
Topic: sum text field depend on the other drop down's value
Replies: 2
Views: 14306

sum text field depend on the other drop down's value

for(int i=0; i<=6, i++){ <tr> <td><span class="amtxt" > <input type="text" name=amacount></span> </td> <td class="w6"><select id="level" class="sum" name="level" size="1"> <option value="">-- Please select --</option> <...
by Lphp
Mon Sep 05, 2016 9:36 am
Forum: Javascript
Topic: rewrite each function
Replies: 3
Views: 15522

Re: rewrite each function

Christopher wrote:Yes you can. Did you try it?
I get it , I need to put outside the
function sumTotal(the_value, curr_vale) {

.......
return sum;
}
$(function() {

sum = sumTotal(".pptxt", $(this).children().val());
});
by Lphp
Thu Aug 25, 2016 9:16 am
Forum: Javascript
Topic: rewrite each function
Replies: 3
Views: 15522

rewrite each function

I have this function var sum = 0; $(".totalprice").each(function() { var val = $.trim( $(this).text() ); if ( val ) { val = parseFloat( val.replace( /^\$/, "" ) ); sum += !isNaN( val ) ? val : 0; } }); can I rewite to something like , because I have a few total var sum = 0; $(&qu...
by Lphp
Wed Aug 26, 2015 10:05 pm
Forum: Javascript
Topic: sum of values from 8 drop down box
Replies: 7
Views: 10626

Re: sum of values from 8 drop down box

Thanks! could I make it to all 8 select boxes get select then add ?
by Lphp
Tue Aug 25, 2015 6:12 pm
Forum: Javascript
Topic: sum of values from 8 drop down box
Replies: 7
Views: 10626

Re: sum of values from 8 drop down box

thanks for the reply, I just need to past the value add to total , can you make your example try able?
by Lphp
Mon Aug 24, 2015 10:01 pm
Forum: Javascript
Topic: sum of values from 8 drop down box
Replies: 7
Views: 10626

Re: sum of values from 8 drop down box

Code: Select all

$(".sum").change(function()  { 
   var  add=0;  
   $("select.sum").each(function() {     
         
        var value=$(this).val();
        
        add =add+ Number(value); 
        //inside alert ok
    });
    alert(add );//not work
    $('#total').val(add);
    });
by Lphp
Mon Aug 24, 2015 8:11 am
Forum: Javascript
Topic: sum of values from 8 drop down box
Replies: 7
Views: 10626

Re: sum of values from 8 drop down box

I can get the every selector , but not the combined $("select.sum").change(function() { // initialize the sum (total price) to zero var combined=0; // $("select.sum").each(function() { var selects = $(this).attr('value'); combined =(selects *1) +combined; //alert(selects) $('#tot...
by Lphp
Mon Aug 24, 2015 6:04 am
Forum: Javascript
Topic: sum of values from 8 drop down box
Replies: 7
Views: 10626

sum of values from 8 drop down box

I have eight dropdown box <select id="actual_grade1" class="sum" name="actual_grade" size="1"> <option value="">-- Please select --</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</...
by Lphp
Thu Mar 26, 2015 10:13 pm
Forum: Javascript
Topic: select on change and current row?
Replies: 3
Views: 7397

Re: select on change and current row?

Thanks for the reply, but the hard code can get the value <<this can get the value <script language="javascript"> $(document).ready(function(){ $('#exam_type1').change(function() { var exam_type=$("#exam_type1").val(); alert (exam_type +"Hi"); }); }); </script> But the ...
by Lphp
Thu Mar 26, 2015 10:56 am
Forum: Javascript
Topic: select on change and current row?
Replies: 3
Views: 7397

select on change and current row?

I have a table , the rows are select from db, the rows is dynamic , and I want my fist td''s value control my second td's value . I have the following code, how can I let my script know which row I click? <tr id =1><td><select id="exam_type"> <option>--Select--</option> <option>exam 1</opt...
by Lphp
Tue Feb 11, 2014 4:18 am
Forum: Javascript
Topic: return false; and form submit
Replies: 0
Views: 3824

return false; and form submit

I use following code to get data list , but in my data List , every row is a form , update is allowed, my problem if I keep return false; my result form will not submit , if I remove the return false; my update submit form is work , bu the java post is not work :cry: $(document).ready(function(){ $(...
by Lphp
Mon Dec 02, 2013 7:20 am
Forum: Javascript
Topic: two dropdown box one is parent one is child
Replies: 4
Views: 5699

Re: two dropdown box one is parent one is child

I have the following code, but is not work if(country != '') { $.ajax ({ type: "POST", url: "test/useraccount.php", data: "p="+ country, success: function(option) { $("#institution").html(option); } }); } else { $("#institution").html("<option v...
by Lphp
Mon Dec 02, 2013 12:06 am
Forum: Javascript
Topic: two dropdown box one is parent one is child
Replies: 4
Views: 5699

Re: two dropdown box one is parent one is child

I have the following now :? <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> </script> <script> $(document).ready(function(){ $('#bonus').change(function() { alert($("#bonus option:selected").text()); }); }); </sc...
by Lphp
Sat Nov 30, 2013 10:15 am
Forum: Javascript
Topic: two dropdown box one is parent one is child
Replies: 4
Views: 5699

two dropdown box one is parent one is child

I wand two drop down box , parent one is state , the child one is city , when state get select the relate city get display. how to do it :x