#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    I want to add a link in option tag but i cant please some 1 help me its urgent


    </div><!--/ Codrops top bar -->
    <header class="clearfix">
    <h1>Simple Effects<span>for Drop-Down Lists</span></h1>
    <nav class="codrops-demos">
    <a class="current-demo" href="index.html">Demo 1</a>
    <a href="index2.html">Demo 2</a>
    <a href="index3.html">Demo 3</a>
    <a href="index4.html">Demo 4</a>
    <a href="index5.html">Demo 5</a>
    <a href="index6.html">Demo 6</a>
    </nav>
    </header>
    <section class="main clearfix">
    <div class="fleft">
    <p>In this example we use a gutter of 5 and stack the items with a slight offset</p>
    </div>
    <div class="fleft">
    <select id="cd-dropdown" name="cd-dropdown" class="cd-select">
    <option value="-1" selected>Choose your favorite animal</option>
    <option value="1" class="icon-monkey">Monkey</option> <option value="2" class="icon-bear">Bear</option>
    <option value="3" class="icon-squirrel">Squirrel</option>
    <option value="4" class="icon-elephant">Elephant</option>

    </select>
    </div>
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    119
    Rep Power
    32
    Sorry but you can't add links to the option tag
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    Oh, yes you can!


    Originally Posted by simplypixie
    Sorry but you can't add links to the option tag
    You can actually add links to the option tag. All it takes is some javascript.

    Read the top rated answer here and you will get your links added.

    Code:
    http://stackoverflow.com/questions/2000656/using-href-links-inside-option-tag
    Last edited by ishnid; February 8th, 2013 at 02:22 AM. Reason: Removed somewhat impolite opening.
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4303
    Are you aware that "jump boxes" cause problems for some users? I recommend you try to find an alternative.
    More information:
    Drop-Down Menus: Use Sparingly
    Creating Accessible Forms: JavaScript jump menus
    Accessible JavaScript onchange select menu
    WAC Tutorials: Jump Menu
    Unobtrusive Jump Menus Using JavaScript

    Originally Posted by PatJarl
    You can actually add links to the option tag. All it takes is some javascript.

    Read the top rated answer here and you will get your links added.
    JavaScript can make them act like links, but they aren't links, so what simplypixie said is true although it doesn't mention the workaround.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    119
    Rep Power
    32
    I agree - my answer was very short and to the point and I should have mentioned that javascript or jquery can be used to 'simulate' links on selection of an option.
  10. #6
  11. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4303
    Originally Posted by simplypixie
    javascript or jquery can be used to 'simulate' links on selection of an option.
    jQuery is JavaScript. It's a great library but it's one of many JavaScript libraries.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    119
    Rep Power
    32
    Originally Posted by Kravvitz
    jQuery is JavaScript. It's a great library but it's one of many JavaScript libraries.
    Yes I know that However the OP might want to do it with plain JS or use the jQuery library which is why I said either or.
  14. #8
  15. No Profile Picture
    Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    45
    Rep Power
    0

    Steal from the Best


    Best way is to copy the full code and paste it on google or some other website... that you can find very easily... then website will automatically search out the errors.... its very helpful for the newbies....

IMN logo majestic logo threadwatch logo seochat tools logo