happy cat image

everdevel

coding

login
NotificationX
  • Currently, only notices of comments are displayed.
  • no comment or please login

find()

find has the ability to select a tag within a certain tag.
It's hard to say, so let's look at the sauce and understand.

HTML

<div class="hello">
	<p>php</p>
	<b>html5</b>
	<h4>css3</h4>
</div>

In the source above, php html5 css3 is wrapped in a different tag in hello.
Let's select the h4 class using find().
Then we'll just hit the red outline of the h4 class in hello.

jQuery

    var hello = $('.hello');
    var h4 = hello.find('h4');
    h4.css('border',1px solid red');

Result

php

html5

css3

In the result above, you can see that only the h4 tag css3 is processed with red outline. The locations are weird due to the influence of Aberdebel's css. Please do not mind.
Then you can use the h4 tag as a selector or why you can think of this one .. When you
practice, you get a moment that you have to use it when you do this.

Source

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>EVERDEVEL :: jQuery Course</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.0.min.js" ></script>
<script type="text/javascript">
$(function(){
    var hello = $('.hello');
    var h4 = hello.find('h4');
    h4.css('border','1px solid red');
});
</script>
<style>
</style>
</head>
<body>
<div class="hello">
<p>php</p>
<b>html5</b>
<h4>css3</h4>
</div>
</body>
</html>

This is the last page of this chapter.

I'm busy, so I can't care.

If you want to take the next course,
please click the Request button below.


    
    

Back to the course

ALL COMMENTS 0

Sort by