var myVar = $(this).attr('name').substr(4);
myVar = myVar.replace(/\][username]/gi, '');
myVar = myVar.substr(1, myVar.lentgh);Faifas On Mon, Sep 14, 2009 at 15:57, Dave Maharaj :: WidePixels.com < [email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
