Find a class in .html()

sam

I have a method in jQuery which is receiving a 'this' reference, so that I can filter out all the html by using:

showSomeThing = function (e) {
    $("#div").html($(e).html());
}
  1. I want to do some filtering on this e before passing that to the div, e.g. I want to find a class named 'someclass' and set it's display to 'none' so that the class will not show in div above.

I'm trying this:

$("#div").html($(e).find("someclass").hide().html();

but it doesn't work.

  1. I also want to search some particular attributes in the html and their values (once I am able to do the above).

Any ideas?

guest271314

Try using .end() , .attr()

$("#div").html(
  $(e).find("someclass").hide()
  .attr({name:"newName", value:"newValue"})
  .end()
  .html()
);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Regex to find css class in HTML markup

javascript find html <tr> with class and with nested <td>

Cannot find css class using Request HTML

Python won't find the class of an HTML table

Find an html element which has a class but the class name is varying or unknown

how to find an html element or group of html elements by id or class in colly?

How to find the highest value of an array index of an HTML class using JQuery

Find div that has no class and no id in PHP Simple HTML DOM Parser

PHP: simple_html_dom - Find text inside a span with class

REGEX to find the class name for style property in html file

(HTML/Javascript) Unable to find the entry class "imagechange" in javascript

Find a word in HTML document and Assign ID/Class to that element

javascript wont find the id/class of html/javascript imported code with XMLHttpRequest

find html element, without proper class name or id, with javascript

Find all class and id names in an Ace Editor HTML script

Error using Selenium (Python): Unable to find class in HTML source code

Why does my program always find a class but if I search for this class in the HTML it does not exist?

How to find only one class in a html that is exactly the same and have two classes with the same name when clicked with a mouse?

Find div with class and it's plain-text using PHP Simple HTML DOM Parser

How can I insert a whole css class before an HTML element that I find?

Find HTML element with jQuery using effective style (style inherited from CSS class, not explicit on element)

Regex to find html div class content and data-attr? (preg_match_all)

How to find with JavaScript only two out of three instances of the same html class?

Find span values with same class name from html string text value

How to find elements by class

Find element with same class

jquery find next class

Puppeteer: find iframe by class

"Could not find the main class"