Skip to content

Author: admin@master

jQuery unbind after first click

This causes multiple buttons to take action: When fileThisEmail runs, I’d like to remove it from ONLY the current one (there are others on the page that still need it): I tried off, but couldn’t seem to get it right. Any ideas? Answer In this case, you have to make the current element no longer ma…

Convert number of days into years, months, days

I have two date pickers that calculates the number of days there are between the two dates. At the moment I’m outputting the number of days (see code below) which is kind of meaningless. I want to output that number in years, months, days. How can I do that? E.g So 01/01/14 to 01/02/15 = 397 days which …

Mongoose find/update subdocument

I have the following schemas for the document Folder: So, for each Page I can have many permissions. In my CMS there’s a panel where I list all the folders and their permissions. The admin can edit a single permission and save it. I could easily save the whole Folder document with its permissions array,…

Trim specific character from a string

What’s the JavaScript equivalent to this C# Method: C# trims the selected character only at the beginning and end of the string! Answer One line is enough: A general solution: Parameter c is expected to be a character (a string of length 1). As mentionned in the comments, it might be useful to support m…