Try this: $('input[name="data[User][username]"]) ? But we're better off by passing an id to the $form->input('username', array('id' => 'username')). This way, we'll be able to use $('#username') to access the element.
On Sep 14, 7:57 pm, "Dave Maharaj :: WidePixels.com" <d...@widepixels.com> wrote: > I know its more of a jQuery question...i asked on the jQuery group but no > luck and its Cake related so I will try here. > > All the forms have this structure name="data[Model][field]" > > How can I get User as a variable from name="data[User][username]" > > var myVar = $(this).attr('name').substr(4); > alert(myVar); > > gets me [User][username] but how can i strip out the rest of the text so i > end up with just User > > Thanks, > > Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---