sam
sam

Reputation: 427

Find a class in .html()

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?

Upvotes: 0

Views: 146

Answers (1)

guest271314
guest271314

Reputation: 1

Try using .end() , .attr()

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

Upvotes: 2

Related Questions