Skip to content

Author: admin@master

Javascript date to sql date object

I’m trying to write a query that takes a Javascript date object and then puts it in an object type that is recognized by both SQL Server and Oracle database types. The issue is that I’m using webservices. So it has to be a string, not an actual passed parameter. Here’s what I mean: Except fi…

Add Active Navigation Class Based on URL

I’m trying to add an active class (i.e. class=”active”) to the appropriate menu list item based upon the page it is on once the page loads. Below is my menu as it stands right now. I’ve tried every snippet of code I could find in this regard and nothing works. So, can someone please ex…

Check how many there are in a with javascript

Following my code: HTML: JS: Why the in the console there are the number 0 instead of 2? Answer Give – document.getElementById(“ul_o”).getElementsByTagName(“li”).length To have a wider answer that ensures the dom is ready for being accessed and updated by JS, we can make use of t…

Select2() is not a function

So i have downloaded select2 i have “installed it” by putting it into my folder and then loaded it on my site when i check the console (where i can see all of the scripts being loaded) i can see the file select2.js I went to their documentation and copied it and added $(“#e9”).select2(…

Use Javascript to create dynamic input id

I want to use javascript to create <input/> tags with a dynamic id (name attribute will be the same) depending on the order in which they appear. I have the first <input/> tag in plain html and a div that should append a new <input/> with an incremented id when clicked: Now, the javascript n…

Prevent typing non-numeric in input type number

Using <input type=number> will cause this.value inside of an event listener to return an empty string if the input is not a valid number. You can see an example of this at http://jsfiddle.net/fSy53/ However, the invalid characters are still displayed in the input. Is there any way to get the value that …

Disable ALT+F4, yes I know it isn’t recommended

I need a JavaScript script that would disable users from closing using ALT+F4. I have looked everywhere but it just everyone just says it isn’t advised. May not even be possible, if it isn’t I will just have to detect when the user does quit out this way and log it in a database. Here is my curren…