我有以下代码:
<div class="content">
<h2>Choose a category</h2>
<ul class="clean menu" id="topics">
<li class="drop png">
<a cat="ntech" class="sec_accnt" href="javascript:void(0);" name="&lid=choose_category_billing" rel="1" style="BACKGROUND-POSITION: 13px -164px">Billing</a>
</li>
<li class="drop png">
<a cat="tech" class="sec_homecontrol" href="javascript:void(0);" name="&lid=choose_category_homecontrol" rel="1" style="BACKGROUND-POSITION: 13px -121px">Home Monitoring & Control</a>
</li>
<li class="drop png">
<a cat="ntech" class="sec_regis" href="javascript:void(0);" name="&lid=choose_category_regis_signin" rel="1" style="BACKGROUND-POSITION: 13px -207px">Registration & Sign In</a>
</li>
</ul>
</div>
现在我想在第二个位置的列表中添加一个新的 li。添加后的代码应该是这样的:
<div class="content">
<h2>Choose a category</h2>
<ul class="clean menu" id="topics">
<li class="drop png">
<a cat="ntech" class="sec_accnt" href="javascript:void(0);" name="&lid=choose_category_billing" rel="1" style="BACKGROUND-POSITION: 13px -164px">Billing</a>
</li>
<li class="drop png">
<a cat="tech" class="sec_net_1" href="javascript:void(0);" name="&lid=choose_category_internet_fios" rel="1">FiOS Internet</a>
</li> <!-- Newly added li -->
<li class="drop png">
<a cat="tech" class="sec_homecontrol" href="javascript:void(0);" name="&lid=choose_category_homecontrol" rel="1" style="BACKGROUND-POSITION: 13px -121px">Home Monitoring & Control</a>
</li>
<li class="drop png">
<a cat="ntech" class="sec_regis" href="javascript:void(0);" name="&lid=choose_category_regis_signin" rel="1" style="BACKGROUND-POSITION: 13px -207px">Registration & Sign In</a>
</li>
</ul>
</div>
我们如何使用 mootools 实现这一目标?我正在使用 mootools 1.3.2。我使用了以下行:
$("#topics").bind('<li class="drop png"><a cat="tech" class="sec_net_1" href="javascript:void(0);" name="&lid=choose_category_internet_fios" rel="1">FiOS Internet</a></li>');
但这是一个错误'null' is null or not an object
。