Skip to main content

attribute contains prefix selector in jquery

Here is the code :

<a href="example.html" hreflang="en">Some text</a>
<a href="example.html" hreflang="en-UK">Some other text</a>
<a href="example.html" hreflang="english">will not be outlined</a>

Here is jquery to handle it

    <script type="text/javascript">
        $(document).ready(function () {          
            $("a[hreflang|='en']").css({ border: "3px green dotted" });           
        });
    </script>

Done :)

Comments