Nesting HTML- anchor tags

前端 未结 5 2000
既然无缘
既然无缘 2020-12-06 17:38

Today I was working on a tab navigation for a webpage. I tried the Sliding Doors approach which worked fine. Then I realized that I must include an option to delete a tab (u

相关标签:
5条回答
  • 2020-12-06 17:42

    Actually, the code I had pasted previously was the generated DOM, after all JS manipulation. If you don't have the Firebug extension for Firefox, you should get it now.

    Edit: Deleted the old post, it was no longer useful. Firebug is, so this one is staying :)

    0 讨论(0)
  • 2020-12-06 17:47

    In spite of nested tags are illegal but writing them using JS will work!, try this:

    $('<a>', {
         href: 'http://google.com',
         html: '<a>i am nested anchor  </a>I am top Anchor'
     }).appendTo($('body'))
    
    0 讨论(0)
  • 2020-12-06 17:56

    I suspect that working or not working nested links might depend if your browser renders page in strict mode (e.g. XHTML DTD, application/xml+html MIMEtype), or in "quirks" mode.

    0 讨论(0)
  • 2020-12-06 18:02

    Nested links are illegal

    0 讨论(0)
  • 2020-12-06 18:06

    They must be doing some really crazy stuff with JavaScript to get it to work (notice how neither the parent nor the nested anchor tags have a name or href attribute - all functionality is done through the class name and JS).

    Here is what the html looks like:

    <a class="page_tab page_tab">
      <div class="page_title" title="Click to rename this page.">Click & Type Page Name</div>
      <a class="delete_page" title="Click to delete this page" style="display: block;">X</a>
    </a>
    
    0 讨论(0)
提交回复
热议问题