html-lists

Why is my onclick event not registered in Firefox?

守給你的承諾、 提交于 2020-01-11 08:50:31
问题 I have a list item with an onclick event. It runs in Chrome and Internet Explorer, but not Firefox. Any suggestions? <li onclick="alert('test');">test test<br></li> 回答1: This works fine for me in Firefox. Check this: JavaScript is enabled in your browser. Try adding a return false; statement in your tag. Or a function like this: function test() { //your code here return false; } Or use this: <a href="#" onclick="alert('hi');">Link</a> or this <a href="javascript:void(0)" onclick="alert('hi');

add li to middle of the ul (jquery)

不问归期 提交于 2020-01-10 19:39:14
问题 How one can add li to middle of the ul. For example if i have list like this: <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> And i want to add addiion li ( <li>new</li> ) after 3rd list? 回答1: var middle = Math.ceil($("#myUL li").length / 2); $("#myUL li:nth-child(" + middle + ")").after('<li>Item New</li>'); 回答2: Try this out: $('ul li:nth-child(3)').after('<li>new</li>'); 回答3: Try this: $('ul li:eq(2)').after(`<li>new</li>`) Use ' or " within braces I have used ` since it

Why use list to do navigation menu instead of buttons?

拜拜、爱过 提交于 2020-01-10 05:16:06
问题 I have inspected many navigation menus on the internet, and they often use lists instead of a button. What is the reason behind this? Why use the button? Thank you. 回答1: There are (at least) two good reasons to use lists. Using lists can help to give an idea of your site's structure which is good in terms of SEO but also if people use either custom CSS or screen readers for accessibility reasons. The second and slightly related one is that it's rather helpful when it comes to creating

Style an ordered list with Cyrillic letters

心不动则不痛 提交于 2020-01-09 11:39:09
问题 There are many possible values for list-style-type CSS property (e. g. decimal , lower-latin , upper-greek and so on). However there are none for the Cyrillic alphabet (which, btw, has different variations for different languages). What is the best way to style an ordered list with Cyrillic letters? (I'm providing a solution I ended up with despite I'm not very happy with it.) 回答1: I know nothing about Cyrillic list schemes so I’m at risk of a bit of cultural embarrassment here, but CSS3

<ol> with numbers another color

。_饼干妹妹 提交于 2020-01-09 06:50:23
问题 <ol> <li>test</li> <li>test</li> </ol> will show as: test test I want to have numbers coloured and text black! I can edit the css, but I do not have access to the HTML. 回答1: The CSS spec gives an example of doing just this. Unfortunately, while it works on Firefox 3, it doesn't appear to work on IE7: <html> <head> <style> ol { counter-reset: item; } ol li { display: block; } ol li:before { content: counter(item) ". "; counter-increment: item; color: red; } </style> </head> <body> <ol> <li

<ol> with numbers another color

主宰稳场 提交于 2020-01-09 06:48:11
问题 <ol> <li>test</li> <li>test</li> </ol> will show as: test test I want to have numbers coloured and text black! I can edit the css, but I do not have access to the HTML. 回答1: The CSS spec gives an example of doing just this. Unfortunately, while it works on Firefox 3, it doesn't appear to work on IE7: <html> <head> <style> ol { counter-reset: item; } ol li { display: block; } ol li:before { content: counter(item) ". "; counter-increment: item; color: red; } </style> </head> <body> <ol> <li

How can I prefix ordered list item numbers with a static string using CSS?

╄→гoц情女王★ 提交于 2020-01-09 05:22:36
问题 I want this HTML... <ol style="list-style:decimal;"> <li>Apples</li> <li>Oranges</li> </ol> ...to render like this Q1. Apples Q2. Oranges In other words, I want the auto-generated numbers to be prefixed with the static string "Q". I've tried CSS like this: ol li:before { content:"Q"; } But that produces this: QApples QOranges I've also tried using "list-style:numbered inside;", but that just shifts the list to the right with the same results. I can't find a way to reference the auto-generated

Remove li tags using javascript array

混江龙づ霸主 提交于 2020-01-07 05:36:08
问题 I'm searching a solution to remove <li> tags filtered using javascript array. Array: var mygroups=["1","8","3","4","5"] Example (input): <li><div>1 element.</div></li> <li><div>2 element. This is my <span>post</span> into new group</div></li> <li><div>3 element. Another one</li> <li><div> <a href="javascript:void(0);">Actor</a> <a href="/groups/viewgroup/1-first-group">First group</a> </div> </li> <li><div><a href="javascript:void(0);">Actor</a> <a href="/groups/viewgroup/10-ten-group">Ten

Count ul tags that are children

北战南征 提交于 2020-01-06 08:25:07
问题 In this list, how can I count how many ul tags there are below the li.selected? I want ul tags from all levels counted, not just direct children. The return in this example should be 2. <ul class="theMenu"> <li> <a href="">Great Britain</a> <ul> <li> <a href="">London</a> <ul> <li><a href="">Trafalgar Square</a></li> <li><a href="">White Heart Lane</a></li> <li><a href="">Paddington Station</a></li> </ul> </li> </ul> </li> <li><a href="">Germany</a></li> <li> <a href="">France</a> <ul> <li

HTML/CSS list box on mobile

旧街凉风 提交于 2020-01-06 02:45:08
问题 The following simple fiddle shows a list box with the set of country names. On a PC the height property tells the page to render a list box instead of a drop-down, and consequently n items are visible. On mobile (iPad/iPhone), the height property seems to tell the page how high the drop down control should be (it looks ridiculous as you'd expect). My CSS class looks like this: .sliderlist { width: 240px; height: 620px; font-size: 12px; font-family: "Verdana", Geneva, sans-serif; } I would