找到一个嵌套<李>和修改它 [英] Finding a Nested <li>, and modifying it

查看:172
本文介绍了找到一个嵌套<李>和修改它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个非常混为一谈的Andr​​oid单位换算应用程序,使用各种可怕的事情,使它pretty。从本质上讲它通过vebviews执行JS,并显示HTML格式按照花式纺纱任意大小列表,其中缩写......等等等等...

I'm writing a very conflated Android Unit Conversion application, using all kinds of terrible things to make it pretty. Essentially its executing JS via vebviews, and displaying html formatted according to arbitrary size lists in fancy spinners, with abbreviations underneath... blah blah...

反正。现在我已经得到了财产以后这样的:

Anyway. Right now I've got somthing like this:

for (l = 0; l < this.slotData.length; l += 1) {
    out += '<li>' + this.slotData[l].values[i] + " "+'<li class="sw-right">'+this.slotData[l].abbreviations[i]+'</li></li>';
}

其中slotData [l]的重presents说Milimeters和缩写是MM,这是下方,并格式化略有不同。这个想法是,你可以输入数字,他们会露面,大Milimeters下面,旁边的小MM,让你可以看到4400毫米。

Where slotData[l] represents say "Milimeters" and abbreviations is "Mm", which is underneath, and formatted slightly differently. The idea is that you can enter numbers, and they will show up, underneath the Large Milimeters, next to the small Mm, so that you can see "4400mm".

我想在我的code不同的点来访问和修改的孩子里,类SW-权利。想知道是否有人知道一个简单的方法来做到这一点?我可以访问父无麻烦,但我不知道什么是正确的路要走,从那里是...

I'm trying to access and modify the child li, of class "sw-right" at a different point in my code. Wondering if anyone knows an easy way to do this? I can access the parent without trouble, but I'm not sure what the proper way to go from there is...

我的访问是财产以后这样的:

My access is somthing like this:

this.slotEl[slot].......

Anythoughts?

Anythoughts?

感谢球员...

纳撒尼尔。

推荐答案

您不应该尝试拼图&LT;立GT; 元素。 HTML语法不允许嵌套列表项。因为&LT; /李&GT; 结束标记是可选的,浏览器很可能只是把你的嵌套的项目,作为第一位的兄弟反正,并丢弃第二个结束标记为双密切的第二个项目。

You should not try to nest <li> elements. HTML syntax does not permit nesting list items. Since the </li> closing tag is optional, a browser might well just treat your nested item as a sibling of the first one anyway, and discard the second close tag as a double-close on the second item.

Addional:既然你试图撰写两部分组成,一个列表项也许你真正想要的是一个的定义列表。对于设置在嵌套的标签范围内的属性,可以考虑使用跨度

Addional: Since you are trying to compose a list item of two parts, maybe what you really want is a definition list. For setting attributes on ranges nested inside of tags, consider using span.

这篇关于找到一个嵌套&LT;李&gt;和修改它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆