Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ordered numbers bold without adding more tags

Tags:

html

jquery

css

How do I get the ordered numbers bold without adding more tags?
Possible in jQuery?

  1. first element
  2. secondelement
  3. thirdelement

1. first element
2. secondelement
3. thirdelement

Best regards
hakan

like image 757
Hakan Wergeni Avatar asked Jul 24 '26 15:07

Hakan Wergeni


2 Answers

Assuming your sample list is an ol list, the following will do the trick.

    <html>
    <head>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" />
        <script type="text/javascript">
            $(document).ready(function () {
                $("ol li").each(function (index) {
                    $(this).wrapInner("<span />");
                });
                $("ol").css("font-weight", "bold");
                $("ol li span").css("font-weight", "normal");
            }
            );
        </script>
    </head>
    <body>
        <ol>
            <li>first element</li>
            <li>secondelement</li>
            <li>thirdelement</li>
        </ol>
    </body>
</html>
like image 91
Mikael Svenson Avatar answered Jul 26 '26 08:07

Mikael Svenson


You can't bold just the list item.

like image 37
Blair McMillan Avatar answered Jul 26 '26 10:07

Blair McMillan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!