user1471378
user1471378

Reputation:

jquery cant read textfield value

I got a problem today with some codes regarding reading textfield value. the value is returned back to the page as the result of a query from a php file: //the first text filed with event calling a php file to query the name's order in the list.

<label for=name>Name</label>
<input id=name name=name type=text placeholder="Individual / Company Director" required onblur="getOrderInList();" >

the function getOrderInList() does a query and sends the result back to the caller page using javascript

parent.document.getElementById('customerorder')=document.getElementById('query_result');

the query result which is an integer, is supposed to be back to the main page where the name text field is in a specific hidden text box customercode

using jQuery i need to show it on the page using an alert for example. but seems to be undefined.

can anyone help me with this.

Upvotes: 1

Views: 161

Answers (2)

thecodeparadox
thecodeparadox

Reputation: 87073

In JavaScript:

parent.document.getElementById('customerorder').value = document.getElementById('query_result').value;

In jQuery:

   $('#customerorder').val( $('#query_result').val() )

Upvotes: 1

Rab
Rab

Reputation: 35572

your code is in javascript and you are mentioning jquery in your question. its a bit confusing but my guess is you need your javascript code to be corrected

parent.document.getElementById('customerorder').value = document.getElementById('query_result').value;

Upvotes: 1

Related Questions