Jump to content

jquery getting values from forms

- - - - -

  • Please log in to reply
1 reply to this topic

#1
chili5

chili5

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 7,247 posts
  • Programming Language:Java, C#, PHP
  • Learning:C, C++, C#, PHP, Transact-SQL, Assembly, Scheme
Hi everyone,

I'm doing some work with jquery and I'm getting stuck on how to get values from a form in my jquery... I have this form element below and want to get the value of this into a javascript variable.

<inputdata-val="true" data-val-required="You must provide a rental address" id="Rental.RenAddress_48391" name="Rental.RenAddress" onBlur="javascript:codeAddress(48391);" style="width:130px;" type="text" value="x" />


I've tried doing this but I keep getting object undefined errors:
var address = $('input[id=Rental.RenAddress_' + 48391 + ']'); can anybody see why this isn't working??James :-)

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Don't put dots in your ids. To get the actual value you also need to add ".val();"




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users