tirenweb
tirenweb

Reputation: 31719

jQuery: trying to get the input value

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

Upvotes: 1

Views: 277

Answers (2)

Praveen Prasad
Praveen Prasad

Reputation: 32117

   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.

Upvotes: 0

Adeel
Adeel

Reputation: 19238

use this

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

OR

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

Upvotes: 7

Related Questions