最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - can I make an alphabetical Ordered List starting at B instead of A - Stack Overflow

programmeradmin2浏览0评论

I have to make a summary of locations with google maps API. On the map there are letters corresponding to the waypoints, I have a separate <div> with all the route information.

Right now I have it set as an <ul>, I want to make it an <ol> with letters. However, since the starting location isn't included in the route information and it has a marker with A on the map my route information needs to start with B.

Is there a way to do this?

I have tried making a list item before the rest with display: none.

I tried using the start attribute.

I tried using the value attribute in bination with a JavaScript array.

<ol id="sortable" class="directions-panel list-container list" type="A">
  <li style="display:none;"></li>
</ol>
<ol id="sortable" class="directions-panel list-container list" type="A" start="B"></ol>
<ol id="sortable" class="directions-panel list-container list" type="A">
  <li value="B"></li>
</ol>

I have to make a summary of locations with google maps API. On the map there are letters corresponding to the waypoints, I have a separate <div> with all the route information.

Right now I have it set as an <ul>, I want to make it an <ol> with letters. However, since the starting location isn't included in the route information and it has a marker with A on the map my route information needs to start with B.

Is there a way to do this?

I have tried making a list item before the rest with display: none.

I tried using the start attribute.

I tried using the value attribute in bination with a JavaScript array.

<ol id="sortable" class="directions-panel list-container list" type="A">
  <li style="display:none;"></li>
</ol>
<ol id="sortable" class="directions-panel list-container list" type="A" start="B"></ol>
<ol id="sortable" class="directions-panel list-container list" type="A">
  <li value="B"></li>
</ol>
Share Improve this question edited Jun 25, 2019 at 12:06 VLAZ 29.1k9 gold badges63 silver badges84 bronze badges asked Jun 25, 2019 at 11:36 Patrick de RondePatrick de Ronde 531 silver badge6 bronze badges 2
  • 6 Use start start=2 instead of start="B" – Walk Commented Jun 25, 2019 at 11:39
  • this works! thanks! @Walk – Patrick de Ronde Commented Jun 25, 2019 at 11:41
Add a ment  | 

1 Answer 1

Reset to default 5

You were close - the start attribute accepts a number as the starting position, regardless if the list displays letters or numbers. All you need is start="2":

<ol id="sortable" class="directions-panel list-container list" type="A" start="2">
    <li>one</li>
    <li>two</li>
    <li>three</li>
</ol>

发布评论

评论列表(0)

  1. 暂无评论