How can I set the max date for today instead of 2018-03-07 dynamically? I tried following methods- Class – but no luck. Answer Try this: Working Example Demo Reason: Because when you are using new Date() this will give you full date with time zone and time etc, you have to assign only Date so you have t…
Tag: javascript
Heroku: “No default language could be detected for this app” error thrown for node app
I am learning NodeJS and the course I’m following has several projects, arranged by sections. I have all the projects under one main folder, which is also a git repository. Each of these subfolders in the main folder is a node project by itself, complete with package.json and related dependencies in nod…
How to get a plain object from mobx object?
I defined a mobx map as below: then I added object on the editors as below: when I get the object from editor as below: the returned object myEditor has some builtin functions such as: I wander how I can get a plain javascript object from editor? Answer You can use toJS. Example
Clicking a href selects hidden radio button
I’m trying to implement a plans page. In this page a user can only select one plan obviously. So I have a form that has radio buttons representing each plan. But Radio buttons are ugly right!? So I’m trying to hide them behind a regular a href styled nicely. Is it possible to have an a href actual…
Have multiple links in an ul but only first link is used on click event
I want the user to be able to choose between two links, however, whichever line they select it always runs the first ‘href’. This is my jQuery code. I assume that it stops running once it finds the first href but I am curious how I can prevent that and allow it to select the second if clicked. Ans…
Prop value lost after running a method Vuejs
I made a material design input field as a Vue component. I listen for the focus event and run a function to check the value every time the user focuses out. Here’s the code: I pass the value as a prop called value and I’ve used that value for the input field using :value=”value”. The t…
Moment.js always returns ‘a few seconds ago’
From the docs: “To get the current date and time, just call moment() with no parameters. This is essentially the same as calling moment(new Date()). Note: From version 2.14.0, moment([]) and moment({}) also return now. They used to default to start-of-today before 2.14.0, but that was arbitrary so it wa…
Open blob objectURL in Chrome
I want to open a PDF in a new tab in chrome browser (Chrome 56.0.2924.87, Ubuntu 14.04) using window.open(fileObjectURL) in javascript. I am creating the blob from base64 encoded data and do create an objectURL like this: It works fine in latest Firefox browser. But in Chrome I can see that the new tab gets o…
Regex match HTML attributes names
I have the following element stored as a String: I want to extract all the attributes names like this: This is what I tried to do, but I get also the values and dosent match the data-animation and disabled: http://jsbin.com/hibebezibo/edit?js,console EDIT: Manged to get attributes using: But I still cant get …
How to watch store values from vuex?
I am using vuex and vuejs 2 together. I am new to vuex, I want to watch a store variable change. I want to add the watch function in my vue component This is what I have so far: I want to know if there are any changes in the my_state How do I watch store.my_state in my vuejs component?