If I understand correctly you are trying to reference the parent form of the input field. You should do it like this: var form = $("#a").parent("form"); alert( form.attr("action"); );
On May 19, 3:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This is my html: > <form id="myForm" action=""> > <input type="text" id="a" /> > </form> > and javascript: > <script type="text/javascript> > $(document).ready(function() { > var form = $('#a').attr('form'); > alert(form.attr('action'));}); > > </script> > it works in IE 7.0, but in FF form is 'undefined', I can get the form > using > var form = $('#a').get(0).form; > > so why attr('form') does not work in firefox?