Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved] Modifying js to show a value +1

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #153810
    opus
    Participant

    Hi, Im trying to modify a js code to display a chosen # in a dropdown menu and add 1 to the displayed #.

    Here is a screen shot explaining.

    var val = jQuery(this).val();
        if (val == "" || val == 'none'){
            jQuery(".persons").remove();
            jQuery('.iff3').text('');
        }
        else
            jQuery('.iff3').text(val); _**// this is the code line displaying the** #_
    
        var curr = jQuery(".persons").length;
    
        if (curr > val){
            for (var i = 0; i < (curr-val); i++)
                jQuery(".persons:last").remove();
        } else {
            var str = '';
    

    How can i modify the code to show val+1? thanks, Alon

    #153820
    opus
    Participant

    Thanks Mottie,
    Tried that,
    But as you can see in screen shot i get 21.

    Alon

    #153823
    lrelia
    Participant

    $('.iff3').text(parseInt(val)+1)

    #153855
    opus
    Participant

    thanks Mottie and Irelia… appears that changing this effects much more then only this.
    will need to hire a programmer :/.

    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.