Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    And here it is.

    http://jsfiddle.net/YmuFA/

    I changed it compared to the previous version, it now looks through each line. This means you shouldn't have more than one heading on a single line, although you could easily fix that, too. I just didn't feel like it.
    This script should also be more readable, though it could still take a lot of improvement. But I ran out of time.

    The ids start with the h1 tag, though. Made more sense to me.

  2. Users who have thanked Airblader for this post:

    RickGervs (07-24-2013)

  3. #17
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    I wonder why the OP wanted to add ids to the h tags. If the sole purpose is to style section and h tags, then it can be done via CSS.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  4. #18
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,694
    Thanks
    80
    Thanked 4,655 Times in 4,617 Posts
    Possibly to then be able to locate content. But in that case, it's a mistake to put them on the <hX> tags. They should go on the <section>s.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  5. #19
    New Coder
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Actually, I need to add IDs because we have a Table of Content, and these kind of ids because it's the standard.

    Any code would work for the IDs problem, I just thought it would have been simpler with Airblader's code.

  6. #20
    New Coder
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Airblader View Post
    And here it is.

    http://jsfiddle.net/YmuFA/

    I changed it compared to the previous version, it now looks through each line. This means you shouldn't have more than one heading on a single line, although you could easily fix that, too. I just didn't feel like it.
    This script should also be more readable, though it could still take a lot of improvement. But I ran out of time.

    The ids start with the h1 tag, though. Made more sense to me.
    Wow man you are a machine, I wish I had your skills.

    Thank you very much


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •