开发者

How do I have jQuery to select custom HTML tags

开发者 https://www.devze.com 2023-01-10 20:52 出处:网络
I have this html: Coral8 <del class=\"diffmod\">SQL, t开发者_开发问答o</del><ins class=\"diffmod\">SQL,to</ins> improve

I have this html:

Coral8 <del class="diffmod">SQL, t开发者_开发问答o</del><ins class="diffmod">SQL,to</ins> improve

I want to grab the <ins> tags. Those seem to be custom HTML tags, so I don't have an ID or classname.

Any thoughts on which jQuery selector can be used to grab them?


Just use the element selector $('ins'). It's little effort to try it out yourself:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>SO question 3432853</title>
        <script src="http://code.jquery.com/jquery-latest.min.js"></script>
        <script>
            $(document).ready(function() {
                alert($('ins').text()); // SQL,to
            });
        </script>
    </head>
    <body>
        <p>Coral8 <del class="diffmod">SQL, to</del><ins class="diffmod">SQL,to</ins> improve
    </body>
</html>

It works. Those are by the way legitimately valid HTML tags.

0

精彩评论

暂无评论...
验证码 换一张
取 消