javascript - How to remove a div if it contains a certain string in it? -


There is a list of items on one page, some are blank, with an example:

 < Code> & lt; Div class = "item item" & gt; & Lt; Div class = "tophead" & gt; & Lt; Div class = "itemnumber" & gt; 30 & lt; / Div & gt; & Lt; One class = "article" href = "" & gt; & Lt; / A & gt; & Lt; / Div & gt; & Lt; Div square = "foothills" & gt; & Lt; One class = "userlink" rel = "" & gt; & Lt; / A & gt; First & amp; Nbsp; & Nbsp; & Nbsp; & Lt; A href = "/ item? Id =" & gt; Discuss & lt; / A & gt; & Lt; / Div & gt;  

Therefore, an example of jQuery or Javascript can be used to find: & lt; A class = "article" href = "" & gt; Remove any class = item of div in any example of div class = item on the page, and then Hide> which is the piece of code?

Updated reply: In the comments based on the explanation, instead Try it:

  $ ('div.item: is (a.article [href = ""])'). Remove ();  

Or it should also work:

  $ ('div.item: has (a.article: not ([href])') . Remove ();  

Or if you have problems with any of these, try:

  $ ('div.item a.article'). Filter (function () {Return $ .trim (this.inner html) == '';}) Closest ('div.item'). Remove ();    

Pre> $ ('Div.item: a.article ()') to delete ();. << Code>

It will select

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -