Skip to content
Advertisement

Add st, nd, rd and th (ordinal) suffix to a number

I would like to dynamically generate a string of text based on a current day. So, for example, if it is day 1 then I would like my code to generate = “Its the <dynamic>1*<dynamic string>st</dynamic string>*</dynamic>”. There are 12 days in total so I have done the following: I’ve set up a for loop which loops through the 12

Using scrollIntoView with a fixed position header

I have a site with a header set to position: fixed. On one of my pages, I use scrollIntoView(true) on an element. My problem is that when scrollIntoView is called, the element gets positioned underneath the header. How would I fix this so that the element is shown just below the header? I’m using the Bootstrap framework and the header

Disable details/summary

When I use the new details tag in combination with a summary I would then like to disable the generated input. I thought that could do the trick, but sadly it doesn’t work. How can one disable the details element? Answer Instead of using the non-existent disabled attribute, you can set a click handler on the <details> element, and prevent

Edit textbox and submit in HTML/ JavaScript [closed]

It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago. I have a textbox in my HTML file. It is basically a comment

Easiest way to convert month name to month number in JS ? (Jan = 01)

Just want to covert Jan to 01 (date format) I can use array() but looking for another way… Any suggestion? Answer Just for fun I did this: Bonus: it also supports full month names 😀 Or the new improved version that simply returns -1 – change it to throw the exception if you want (instead of returning -1): Sry for

How can i refresh form after submit?

i have form like for form submit i have used like Here reset is not working. Any problem with reset i am not getting. After form submit, i want to refresh form with db values (to display values selected just now). how can i refresh page after submit or either div refresh. Answer reloads the page by setting the href

THREE.js Ray Intersect fails by adding div

My Three.js script runs fine when there is only one target div on the page (which holds renderer.domElement). As soon as I add another div with fixed height and width above the target div, ray.intersectObjects returns null. I doubt that the vector that I am creating for ray is causing the problem. Here is the code. Any ideas on how

Advertisement