I would like remove next element of a selected element. Here, I would like to remove "div" with css class "xqh_Mandatory_icon".
<div class="xqh_Field">
    <nobr>
     <input name=
    "ctl00$objContentPageTag$spzContactInformation$txt_sContactFirstName$txt" type="text"
    size="25" id=
    "ctl00_objContentPageTag_spzContactInformation_txt_sContactFirstName_txt" class=
    "xqh_TextBox_Edit validate_txt_sContactFirstName" style=
    "width:150px;margin-right:0px;" />
     </nobr>
     <div class="xqh_Mandatory_icon"></div>
</div>
I tried with this code
$('.xqh_TextBox_Edit.validate_txt_sContactFirstName').next().remove('xqh_Mandatory_icon');
but it didn't work.
<html>
<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('.xqh_TextBox_Edit.validate_txt_sContactFirstName').next().remove();
        });
    </script>
</head>
<body>
    <div class="xqh_Field">
        <input name="ctl00$objContentPageTag$spzContactInformation$txt_sContactFirstName$txt"      type="text" size="25"               id="ctl00_objContentPageTag_spzContactInformation_txt_sContactFirstName_txt"     class="xqh_TextBox_Edit validate_txt_sContactFirstName" style="width:150px;margin-right:0px;">     
        <div class="xqh_Mandatory_icon">
            yep
        </div>
    </div>
</body>
</html>
Set it to execute the code when the document is ready, also you were missing the period for the second class name. You had a space there instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With