views:

35

answers:

2

Hi,

i'm trying to obtain an input value with this:

var $a = ('#telephone_number').val();

alert($a);

But nothing, any idea?

telephone_number is the id of the input.

Regards

Javi

+5  A: 

use this

var $a = jQuery('#telephone_number').val();

OR

var $a = $('#telephone_number').val();
Adeel
Thaqt's the same code as the OP has, which doesn't work for him. There's something else wrong.
GenericTypeTea
@GenericTypeTea: OP is missing the `$` to signify a JQuery function call which is why it's not working.
JungleFreak
@JungleFeak - O yeah :). Sorry! +1
GenericTypeTea
A: 
   var $a = $('#telephone_number').val();

    alert($a);

currently you are not passing the div id to jQuery, u are just doing (#tel_no) this is wrong.

Praveen Prasad