Link to home
Start Free TrialLog in
Avatar of RTSol
RTSol

asked on

get text from inpu

Hi,

I am trying to get the text from an input of type text like so:
<input type="text" id="inpAvg" name="gasaverage" value="" style="width: 60%;" />

Open in new window

with this jQuery
var avg = $("#inpAvg").val();

Open in new window

but it returns an empty string no matter what I put in the input.

What is wrong?

Best regards
RTSol
Avatar of leakim971
leakim971
Flag of Guadeloupe image

http://jsfiddle.net/zrej6aj8/

<input type="text" id="inpAvg" name="gasaverage" value="IM NOT EMPTY" style="width: 60%;" />
You should remove the value="" part of the input HTML.
Avatar of RTSol
RTSol

ASKER

It's very dtrange but nothing of the above works fro me. The input resides inside a view in a hybrid mobile app. I am going nuts. Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Elxn
Elxn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RTSol

ASKER

It's a lot of code but the id is unique
provide a link this website
Avatar of RTSol

ASKER

Well - it is a mobile app so I can't.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RTSol

ASKER

Hi guys,

Sorry for the delay. It actually was a problem with multiple IDs. I was using requirejs and didn't realize that all the html was lodaed when the app was run. stupid of me - thanks.

Best regards
RTSol