Nesting HTML- anchor tags

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 00:52:46

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>
Jarosław Przygódzki

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 :)

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.

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'))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!