0

I have the following markup:

<div class="scheduleNav">
    <a id="btnPrevDate" href="#" class="ui-button-icon-only" />
    <span id="currentDate">???</span>
    <a id="btnNextDate" href="#" class="ui-button-icon-only" />
</div>

And the following javascript:

var rightNow = new Date(); //   Default to today
var dd = rightNow.getDate();
var mm = rightNow.getMonth() + 1;
var yyyy = rightNow.getFullYear();
if (dd < 10) { dd = '0' + dd; }
if (mm < 10) { mm = '0' + mm; }
var today = (mm + "/" + dd + "/" + yyyy);
var prev = $('#btnPrevDate').button({ icons: { primary: "ui-icon-seek-prev"} });
var next = $('#btnNextDate').button({ icons: { primary: "ui-icon-seek-next"} });
var currentDate = $('#currentDate');
currentDate.text(today);

The jsbin is here: http://jsbin.com/AgiSICE/1/edit?html,js,output

How can I prevent the first anchor from swallowing the span?

1
  • The example you provided has multiple errors... Commented Oct 29, 2013 at 22:02

1 Answer 1

1

When I closed your first anchor by adding instead of it worked for me.

Sign up to request clarification or add additional context in comments.

2 Comments

sorry, <a></a> vs <a blah blah /> here's a jsbin link jsbin.com/eYITEZo/1/edit
Any explanation on that btw? Why using the closed version of the element doesn't work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.