1

I'm trying to retrieve the customers name by alert based on the account number that's entered into the textbox by i'm having trouble referencing the textbox (>>txtFree<<). I just not sure what i must replace it with if anyone could help please.

HTML

Account Number: <input type="text" id="txtFreeBank" name="txtFreeBank" />

JS

function checkBankAc() {
        var txtFree = parseFloat(document.getElementById('txtFreeBank').value);

        var bankdetails = Parse.Object.extend("BankDetails");
        var query = new Parse.Query(bankdetails);
        query.equalTo("AccountNum", >>txtFree<<);
        query.find({
            success: function (results) {
                alert("Successfully retrieved " + results.length + " scores.");

                for (var i = 0; i < results.length; i++) {
                    var object = results[i];
                    alert(object.id + ' - ' + object.get('CustomerName'));
                }
            },
            error: function (error) {
                alert("Error: " + error.code + " " + error.message);
            }
        });
    }
6
  • Can you log txtFree? Does it get the desired value? Commented Jan 6, 2016 at 17:44
  • Not sure if i'm even doing that 100% right but it returns the value I enter? Commented Jan 6, 2016 at 17:57
  • That's what I meant. Are you using query.equalTo("AccountNum", >>txtFree<<); or query.equalTo("AccountNum", txtFree);? Commented Jan 6, 2016 at 17:59
  • No, sorry for the confusion i'm using txtFree, i just used that to emphasize that I don't know what I need to replace >>txtFree<< with. Commented Jan 6, 2016 at 18:05
  • are you attaching this javascript inside the <script> html tag? How are you calling the javascript? Commented Jan 6, 2016 at 18:28

1 Answer 1

1

You will be able to access the data entered switching your >>txtFree<< for the following:

document.getElementById('txtFreeBank').value
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you ... i was just missing the .value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.