0

I'm trying to update an input value using jquery and I can't get it to do anything. I've tried .val(), .attr, .html, .text.

$('#acctnum').click(function(){
        var index = this.selectedIndex;
        var bal1 = $('#bal1').val();
        var bal2 = $('#bal2').val();
        var bal3 = $('#bal3').val();
        var bal4 = $('#bal4').val();


        if (index == 0){
            $('#poamnt').val(bal1);
            alert (bal1);
        } else if (index == 1){
            $('#poamnt').val(bal2);
            alert (bal2);
        } else if (index == 2){
            $('#poamnt').val(bal3);
            alert (bal3);
        } else if (index == 3){
            $('#poamnt').val(bal4);
            alert (bal4);
        }

    });

Here is the html

 <li><label for="poamt">PO Amount</label> <input readonly type="text" id="poamt" name="poamt"/></li>

I can console.log and get the correct index number and val from my vars.

2
Contributors
1
Reply
12
Views
2 Years
Discussion Span
Last Post by cool_zephyr
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.