jQuery Selectors: Using meta or special characters

This entry is part 10 of 33 in the series jQuery Selectors

In the previous example, the image src url starts with https://codecrawl.com.

The 2 forward slashes // are meta characters.

If the image source has the below url, we would need to use escape character with 2 backslashes \\ in the selector.

<img src=’//codecrawl.com/code/images/ushuaia.jpg’>

The selector would need to be established as $(“img[src^=’\\/\\/code’]”).

<!DOCTYPE html>
<html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Image</title>
    <script src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'></script>
    <script>
        $(function () {
            $("img[src^='\\/\\/code']").css('height', '200px');
        });
    </script>
</head>
<body>

<h4>Ushuaia</h4>

<p>Southernmost city in the world.</p>

<img src='//codecrawl.com/code/images/ushuaia.jpg'>

</body>
</html>

 

HTML: Applying bold and italic formatting

This entry is part 3 of 34 in the series HTML

Applying bold and italic styles are two ways of making text stand out and attract attention.

For simple boldface and italics, use the <b> tag and the <i> tag.

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Bold & Italic</title>
</head>
<body>

<p>I have like to go to <b>Thailand</b> for fun.</p>
<p>And to have some <i>great times</i> there.</p>

</body>
</html>

Here I have used lang=’en’ to state that the page is using English language as its default language.

Here I have also used <meta charset=”UTF-8″> for character encoding.  This is recommended by W3C for use in HTML and XML.

UTF-8 has basically become the dominant character encoding for the World Wide Web.