On Sep 17, 2009, at 5:13 AM, Charlie Griefer wrote:

Pretty sure you need single quotes around bar.

alert($("input[name='bar']").val());

No. The single quotes are unnecessary.

On Thu, Sep 17, 2009 at 1:27 AM, pritisolanki <pritiatw...@gmail.com> wrote:

Thanks Ralph.

I tried following

 alert($("input[name=bar]").val());

and rather then showing it's value it alert undefined ??? why?


Where are you including your script tag? If it's in the <head>, are you wrapping your alert() in $(document).ready? Are you sure you have an input with name="bar"?

Try this:

$(document).ready(function() {
  alert( $("input[name=bar]").val() );
});


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com


Reply via email to