jQuery selector depending on children

Posted by wiradikusuma on Stack Overflow See other posts from Stack Overflow or by wiradikusuma
Published on 2010-04-19T16:53:22Z Indexed on 2010/04/19 17:03 UTC
Read the original article Hit count: 161

Filed under:

Hi guys, I have an HTML form consisting of some text-inputs. I'm using jqTransform to prettify them. Now I want to add two buttons that will add and remove text-input dynamically.

Adding is easy: $('#container').append(''); $('input[name=foo]:last-child').jqTransInputText();

But removing is tricky: $('WHAT-TO-SELECT').remove();

I can't do "input[name=foo]:last-child" since it's already wrapped (some divs) by jqTransform. To put this question in another way: How do I select based on "who has child of type input with 'foo' as its name"?

© Stack Overflow or respective owner

Related posts about jquery-selectors