JQuery Validate errorPalacement
I have following CSS in my application
- .input_wrapper {
- border: 1px solid #cecece;
- display: block;
- background: #fefefe url(layout/site/forms/input_text2.gif) repeat-x;
- float: left;
- padding: 2px 0px;
- width: 150px;
- margin: 0 8px 0 0;
- line-height: normal;
- }
- .blank {
- border: 0;
- background: transparent;
- }
Using above CSS like this
- <div class="row">
- <label>Contact Person <span style="color:Red">*</span> :</label>
- <div class="inputs">
- <span class="input_wrapper large_input"><asp:TextBox runat="server" CssClass="text" ID="txContactPerson" Text='<%#Bind("contactPerson") %>'/></span>
- <span class="error"></span>
- </div>
- </div>
- <div class="row">
- <label>Channel <span style="color:Red">*</span> :</label>
- <div class="inputs">
- <span class="input_wrapper blank">
- <asp:DropDownList ID="dpChannel" runat="server" selectedvalue='<%#Bind("channel") %>' AppendDataBoundItems="true" DataSourceID="ChannelDataSource" DataTextField="Data" DataValueField="Value">
- <asp:ListItem>-- Please Select --</asp:ListItem>
- </asp:DropDownList>
- <asp:ObjectDataSource ID="ChannelDataSource" runat="server" SelectMethod="GetDropDownByGroup" TypeName="_DropDownBLL">
- <SelectParameters>
- <asp:Parameter Name="Group" DefaultValue="DP_CHANNEL" />
- </SelectParameters>
- </asp:ObjectDataSource>
- </span>
- </div>
- </div>
But now my problem is that when I call validate function error display is inside the textbox and for dropdown it comes perfectly. But when I put following code in JQuery
- errorPlacement: function (error, element) {
- error.appendTo(element.parent().next());
- }
error display will come properly down to the textbox but my dropdown become red. So in my above Jquery how I will deal with DropDown or how can I put error in
<span class="error"></span> that I m putting after all element which I am going to validate.