Jquery中filter/not/split用法

1.脚本部分
 $(function () {
            //alert($("p").filter(".selected").html());
            //alert($("p").not(".selected").html());
            //alert($("p:not(.selected)").html());

            $("input[value=btn1]").click(function () {
                alert($("span.sale").text().split("¥")[2] + "||" + $("span.sale").text().split("¥")[1] + "||" + $("span.sale").text().split("¥")[0]);                
            })
        })
2.html部分
 <div style="border:1px solid red;500px;height:150px;">
        <p class="selected">Hello</p><p>How are you?</p>
<!--
一个新的挑战是从一组类似或相同的元素中只选择某一个特定的元素。
jQuery提供了filter()和not()来做这个。
filter()能够将元素精简到只剩下满足过滤条件的那些,not()恰恰相反,他移除了所有满足条件的。-->   
    </div>

    <div style="border:1px solid red;500px;height:150px;">
        获取价格120:<input type="button" value="btn1" ><br>
 
<span class="sale">
Out Sale: ¥160<br />
Deal Price: ¥120</span>
 
 
<!--
应用split来解决这个问题。下面给出一个用split的实例:
msg ="2007/10/01";
     msg = msg.split("/");
     alert(msg[2]);
     他会把 msg 分成一个3块组成一个数组 ,然后就可以轻松获取了。
     -->
    </div>
原文地址:https://www.cnblogs.com/zpc870921/p/2640535.html