Select all items of union but not the last one!

Posted by 100r on Stack Overflow See other posts from Stack Overflow or by 100r
Published on 2010-06-16T16:10:14Z Indexed on 2010/06/16 16:12 UTC
Read the original article Hit count: 180

Filed under:

I have few texboxes, dropdown lists, etc.. They have their css classes. I want to select all elements of specific class(es) but NOT the last element from group of all classes.

<asp:TextBox ID="TextBox1" runat="server" CssClass="class1" ></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" CssClass="class2" ></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server" CssClass="class2" ></asp:TextBox>

I want to select only TextBox1 and TextBox2, not TextBox3!

selector should be something like this

$("(.class1,.class1):not(:last)")

or something like

    $(".class1,.class1").filter(":not(:last)")

but of course none of it is working :)

any sugestions? tnx in advance!

© Stack Overflow or respective owner

Related posts about jQuery