That's exactly how you'd do it.

One thing I use for debugging is to throw an alert like so:

alert($("form[name=myForm]").length);

To make sure that your original query is returning a result.



andy

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of bob
Sent: Tuesday, February 03, 2009 3:54 PM
To: jQuery (English)
Subject: [jQuery] how to get action attribute from form


Hi,

How do I get action attribute from the following form if I know id and name
values.


<form name="myForm" id="myForm" method="post" action="register.php"
onsubmit="return false;">

I tried those and it did not work:

$("form[name=myForm]").attr('action');
$("#myForm").attr('action');


Reply via email to