Hiding an inner div tag using jQuery?

Normally, you would identify a table first, but without that information.

Normally, you would identify a first, but without that information: $('th:contains(Value2)').hide(); Note that the above will look for "Value2" as part of any other text, so "Value21" will cause it to match too. For something more robust, that strictly matches "Value2", as well as ignoring leading and trailing whitespace, then: $('th'). Filter(function () { return $.

Trim($('div', this).text()) == "Value2"; }).hide().

I want to hide the div with value2 not just second div – Nitesh Jul 6 at 23:43 @Nitesh, was just going to clarify. Updated my answer now. – Box9 Jul 6 at 23:47 Sweet...that worked!...thanks for your help!

– Nitesh Jul 6 at 23:51.

To hide 'div' $("thead. Line-item-grid-header tr th div:contains(Value2)").hide(); To hide 'th' $("thead. Line-item-grid-header tr th:contains(Value2)").hide(); Please see example jsfiddle.net/JURSU/1.

For more information: api.jquery. Com/category/selectors – djlumley Jul 6 at 23:42 I want to hide the div with value2 not just second div – Nitesh Jul 6 at 23:43 that worked. I used $("thead.

Line-item-grid-header tr th div:contains(Value2)").hide(); instead but actually I want to hide the th tag which is surrounding that particular div tag – Nitesh Jul 6 at 23:47 That's a pretty nasty selector @Nitesh – melee Jul 6 at 23:51 thanks guys for your time..got my answer..appreciate your help! – Nitesh Jul 6 at 23:54.

Always try to give id to elements which you need to access in order to get values, toggle visibility and more. It makes your life easier and prevents your human errors. Otherwise you can specify class name and access them via jquery to process them.

For example: Value1 Value2 Hope this helps.

I suggest that you add some class value (even if there is no explicit css style defined for that class) OR add some id to your divs. That way you can directly find them by id or class. Another solution will be to have id or class to the parent div and then traverse the div you want to reach. Finding the div by it's containing text might break if the content changes.

If the text is always fixed, then you can go that route. I just tested this, it works. Please try and let me know how it goes...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions