How to create ascending-numbers (1,2,3...) CSS IDs and corresponding hrefs with JavaScript?

Nobody here has been asking for <a> tags to be put into the CMS.

I put your request through to the team yesterday, and they want this thread to be left open, as other benefit can occur.

When you’re ready - we are willing to take things further with you.

@Paul_Wilkins

Nobody here has been asking for <a> tags to be put into the CMS.

I didn’t ask about it but I was suggested to use these by PaulOB instead <span> tags and these didn’t work due to a CMS bias.

When you’re ready - we are willing to take things further with you.

About the current issue I don’t recognize anything to be ready to; in general I should no longer response about it and let the it be automatically locked.

That wasn’t in regard to the content in the CMS, but is instead about the plan for what you want the JavaScript code to achieve as a final end result on the page.

With a plan for what you want to achieve, we can come up with JavaScript to achieve that.

As I offered before, come back when you’re ready. We’ll be here.

As I offered before, come back when you’re ready. We’ll be here.

Well, I think it’s not about being ready or not because the JavaScript is fine if the end result wasn’t biased in various ways from the CMS.

Am I misunderstanding something here? The CMS doesn’t have anything to deal with at all about the end result.

I kindly disagree; a CMS could have some backend extreme behavior that will make other codes practically ineffective as with MediaWiki’s lack of support in <a> (these would be parsed as plain text) tags so JavaScript aimed for such tags will practically be ineffective.

Oh and one more thing: I already understood I had a wrong premise in the question — thinking that HTML tags differ just in semantics and nothing more so that any other difference is due to browser’s ability to add them default attributes.
This is why I tried to use <span> with href attribute as links and this is the basic mistake I had;
The notion that the difference between HTML tags is only semantics is broadly true, but not totally true, as I have learned from this case.

Only after that mistake, comes the technical reality were <a> tags aren’t allowed in the current version of MediaWiki so I I think I will most likely take a Cite MediaWiki extension AND Scribunto MediaWiki extension backend approach;
I have further learned about such a backend solution and I think it’s easier to implement it than I have previously thought.

Then please help me to understand.

  1. There are no anchor links in the CMS.
  2. The CMS creates HTML code to show on the HTML page.
  3. JavaScript adds anchor tags.to the HTML page.
  4. The HTML page now has anchor tags.

Where does the anchor tag problem occur with that?

1 Like

I am sorry, bad phrasing: What isn’t supported is <a> tags in a Wiki document;
The CMS creates HTML code based on Wiki documents that are allowed to be created from Wiki syntax and limited HTML markup support — limited because <a> tags in the Wiki documents aren’t allowed and are therefore parsed as plain text.
JavaScript aimed for such <a> tags (via relevant selectors, if exist) is therefore practically ineffective.

I don’t know how many times I need to repeat this, but I’ll try again. Nobody wants you to put anchor tags in the CMS. The CMS never has to deal with anchor tags at all. You and us are in agreement about that.

Please read the following more carefully, to understand that.

I wanted myself to put them in the CMS when I didn’t know the deliberate prevention of parsing that specific tag in that specific CMS.
Know when I know of that limit I no longer want to do that.

Please read the following more carefully, to understand that.

I have read it again, “more carefully” and I don’t know what JavaScript you referred to - I don’t recall creating JavaScript which creates <a> tags. I did try to add an href attribute to a <span> tag via JavaScript but this was a mistake based on my false assumption that the only difference between all (instead most) HTML tags is just semantics (i.e the name of the tags).

This is the JavaScript forum in which you came to ask for JavaScript help. The plan so far as I understand it (please correct me if I’m wrong) is to use JavaScript to generate the footnotes, which is already working, and also to let someone click on footnotes or reference numbers which link from one to the other.

Yes,
I tried to give that clicking behavior by href on <span> tags based of the false premise I described above but it didn’t work because I had to use <a> instead <span>.
When I tried using <a> it also didn’t work because my CMS parses mere <a> tags as plain text to prevent spam and I don’t want to change the CMS in that regard.

Eventually I have decided to no trying to achieve the clicking behavior in JavaScript and to take another, backend, approach.

That clicking behaviour is something that JavaScript can do for you, and it doesn’t need any links in the CMS at all.

We can easily do that for you.

All we want from you is for you to let us know what you want for the links. When JavaScript creates the HTML links on the page, what do you want the HTML links to look like? How do you want the HTML links to be coded?

@Paul_Wilkins

That clicking behaviour is something that JavaScript can do for you, and it doesn’t need any links in the CMS at all.

We can easily do that for you.

I don’t want anyone to do anything for me in the context of this topic.

All we want from you is for you to let us know what you want for the links. When JavaScript creates the HTML links on the page, what do you want the HTML links to look like? How do you want the HTML links to be coded?

What I want and should achieve backendly is clickable footnote numbers which clicking on them leads the user to a relevant footnote.

I don’t want JavaScript to create any HTML in that regard and I think that opinionating about what might be an HTML structure for such mode is redundant because I don’t code such a mechanism with plain HTML-CSS-JS.

That seems odd, for JavaScript is already creating lots of HTML code for the footnotes.
Why don’t you want JavaScript also creating links to let people use clickable footnotes?

Because I no longer create anything myself in that context with JavaScript (neither the footnote numbers and corresponding footnote numbers).

I have decided to take a full backend (Wiki syntax) approach instead.

Ahh, so you are no longer wanting any kind of JavaScript assistance. Our work here is done.

This falls in with my line of thinking, that the most reliable JavaScript code is no code at all. :slight_smile:

1 Like