JavaScript Search and Hide Text Using Jquery hide search text in datatable,jquery datatable hide search text

I want to use jQuery to look for some text and it exists I want to hide it.

So if : Yes exists it should be hidden.

HTML:

<div class="listing_detail col-md-4"><strong>Living Room:</strong><span class="hide-this-tag"> Yes</span></div>
<div class="listing_detail col-md-4"><strong>Kitchen:</strong><span class="hide-this-tag"> No</span></div>

Jquery:

 $('.listing_detail:contains("Yes")').hide('.hide-this-tag');

The above Jquery hides the whole div rather than just : Yes

Fiddle

Answer:1

You can't pass a selector to .hide(). You use it on an object:

$('.listing_detail:contains("Yes")').find('.hide-this-tag').hide();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="listing_detail col-md-4"><strong>Living Room:</strong><span class="hide-this-tag"> Yes</span></div>
<div class="listing_detail col-md-4"><strong>Kitchen:</strong><span class="hide-this-tag"> No</span></div>
Answer:2

Try this:

$('.hide-this-tag:contains("Yes")').hide();
OR
$('span.hide-this-tag:contains("Yes")').hide();
OR
$('div.listing_detail span.hide-this-tag:contains("Yes")').hide();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="listing_detail col-md-4"><strong>Living Room:</strong><span class="hide-this-tag"> Yes</span></div>
<div class="listing_detail col-md-4"><strong>Kitchen:</strong><span class="hide-this-tag"> No</span></div>
Answer:3

I have an image in the center of my webpage. Once the user scrolls and the image hits the top of the window, I am attempting to fix the image to the top of the page so that it scrolls with the page. ...

I have an image in the center of my webpage. Once the user scrolls and the image hits the top of the window, I am attempting to fix the image to the top of the page so that it scrolls with the page. ...

I want to set date and time to 2016-05-11T00:00:00.000Z var date = new Date(2016,4,12,0,0,0,0); but instead of showing Date 2016-05-11T00:00:00.000Z its giving Date 2016-05-11T19:00:00.000Z I want ...

I want to set date and time to 2016-05-11T00:00:00.000Z var date = new Date(2016,4,12,0,0,0,0); but instead of showing Date 2016-05-11T00:00:00.000Z its giving Date 2016-05-11T19:00:00.000Z I want ...

  1. javascript setting date
  2. javascript setting date format
  3. javascript date setting time zone
  4. javascript date setting time
  5. javascript datepicker setting date

I need to add CSS properties on each element of a collection with jQuery. Any suggestions? var jsonCss = { "color": "#555555", "font-weight": "bold", "text-align": "left" }; var $...

I need to add CSS properties on each element of a collection with jQuery. Any suggestions? var jsonCss = { "color": "#555555", "font-weight": "bold", "text-align": "left" }; var $...

  1. properties collection in java
  2. properties collection in spring
  3. properties collection in c#
  4. properties in collection
  5. properties in collection javatpoint
  6. collection properties in blue prism

I am using the hammer.js touch library to run certain actions on text within an svg file. A sample can be seen at http://codepen.io/cmgdesignstudios/pen/mebqeW In my sample, if you tap any letter, ...

I am using the hammer.js touch library to run certain actions on text within an svg file. A sample can be seen at http://codepen.io/cmgdesignstudios/pen/mebqeW In my sample, if you tap any letter, ...