Welcome To Snipplr

Everyone's Recent JavaScript Snippets

« Prev 1 2 3 4 5 ... 67
<p><div id="calc"> <p><b>VAT rate:</b> <input type="text" id="vat_rate" placeholder="20" size="10" value> <p><b>Net price:</b> <input type="text" id="net_price" size="10" value> <p><b>Gross price:</b> <input type="text" id="gross_price" size="1...
0 621 posted 4 months ago by antonykidless
This is used to validate a date in a specific format. The code example is to validate whether it is a valid dd/MM/yyyy Date Format.
0 891 posted 5 months ago by jlustre
Use to sort table columns by clicking on the table headings
0 698 posted 5 months ago by jlustre
This code is used to get the unique values of an array.
0 667 posted 5 months ago by jlustre
JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object based Programming language. Example Note: This is an example, you can change...
0 753 posted 7 months ago by priyagchaudhary
It works for me
0 760 posted 10 months ago by cerxx
There is no need to use jQuery particularly to manipulate cookies.
0 714 posted 10 months ago by cerxx
Get User IP By jQuery Ajax
0 743 posted 10 months ago by cerxx
Here is a code that force to fire a click on iOS devices, where there is first a touchstart event
0 151 posted 1 year ago by cerxx
JavaScript regex for validating IP addresses, has been tested!
0 121 posted 2 years ago by plasticbottle
This snippet code allows you to prevent the viewer from being able to right-click on your page. This can discourage the average user from borrow images or code from your site.
0 143 posted 3 years ago by apphp-snippets
A one-liner that converts a decimal number to a binary number
0 131 posted 3 years ago by rm1984
How to pass a parameter into a method from an onClick method found in the render method. Majority of the times when you need to do this, your adding it through a loop. In this case, call a function where the item in the loop will automatically be...
0 113 posted 3 years ago by heathbo
Detect the OS of mobile device
0 116 posted 4 years ago by envane21
ResponsiveBootstrapToolkit : https://github.com/maciej-gurban/responsive-bootstrap-toolkit
0 111 posted 4 years ago by dhjapan
change the button text on wrong answer
0 119 posted 4 years ago by envane21
Filters a dynamics CRM 2011 subgrid...implementation example included at bottom
0 118 posted 4 years ago by skinnymoore
Use ref with getDOMNode() to get the actual html. Using getBoundingClientRect() on the actual html will give you the width, height, etc. Below: specs = ClientRect {} bottom: 269 height: 18 left: 797.546875 right: 1062.609375 top: 251 width: 2...
0 213 posted 4 years ago by heathbo
Within a react component. How to gain access to the HTML that was just rendered. Any returned html element that is tagged with a ref, can easily be accessed by it's ref after it's been rendered. In the below case, use this.refs["domainModal"] to...
0 113 posted 4 years ago by heathbo
When creating a new https://codepad.co/ snippet, the default language will be set to 'JavaScript'.
0 136 posted 4 years ago by avansare
You know that iFrames are a necessary evil for many of us. When yuo put a third party site in an iframe is always a risk because they can break out of that iframe and redirect the visitor to another location. This code acts as a defense for such case...
0 116 posted 4 years ago by apphp-snippets
Sometimes you may want to show the visitor that you are aware of their IP address. You can do so by using few lines of code as shown here. Place the code in any place of your page, where you want the IP address to appear:
0 134 posted 4 years ago by apphp-snippets
Check if the checkbox is checked or not on button click
0 147 posted 4 years ago by envane21
Array.prototype.forEach You can't break forEach. So use "some" or "every". Array.prototype.some some is pretty much the same as forEach but it break when the callback returns true. Array.prototype.every every is almost identical to some except i...
0 133 posted 4 years ago by Waltem
Using underscore.js, you could combine .findWhere with .without Although, since you are creating a new array in this case anyway, you could simply use _.filter or the native Array.prototype.filter function (just like shown in the other question)....
0 610 posted 4 years ago by Balamir
// create a variable to toggle debugging // to use it, just call debug(with,any,optional,parameters) debug(x,y,z); // it will try to guess what type of message to log, or you can specify in the first parameter debug("error",x,y,z);
1 136 posted 4 years ago by brandonjp
Allows for forname.o'[email protected]
0 111 posted 5 years ago by flatearthcomms
To do this for any object in JavaScript will not be simple or straightforward. You will run into the problem of erroneously picking up attributes from the object's prototype that should be left in the prototype and not copied to the new instance. If,...
0 162 posted 5 years ago by BrentS
delete Operator don’t impact the length of Array in JavaScript
1 129 posted 5 years ago by ursdeep
« Prev 1 2 3 4 5 ... 67