Hide element from DOM in jQuery

Last Reply 11 months ago By pandeyism

Posted 11 months ago
Dear All,
I am new to Jquery, Please help me.
I need to remove the text 'Commercial' and 'Government' from the DOM HTML.
I have tried with the below code, It did not work 


Posted 11 months ago

Share your html and javascript code.

Posted 11 months ago

Hi bhadriau,

Refer below sample.


<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
    $(function () {
        if ($("#lblCommercial").text() == 'Commercial') {
<label><input type="radio" id="chkCommercial" /><span id="lblCommercial">Commercial</span></label>
<br />
<label><input type="radio" id="chkGovernment" /><span id="lblGovernment">Government</span></label>