Welcome To Snipplr


Everyone's Recent JavaScript Snippets



« Prev 1 2 3 4 5 ... 65
<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 12522 posted 4 years 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.
1 18198 posted 4 years ago by jlustre
Use to sort table columns by clicking on the table headings
0 11159 posted 4 years ago by jlustre
This code is used to get the unique values of an array.
0 11599 posted 4 years 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 10695 posted 4 years ago by priyagchaudhary
It works for me
0 5741 posted 4 years ago by cerxx
There is no need to use jQuery particularly to manipulate cookies.
0 5060 posted 4 years ago by cerxx
Get User IP By jQuery Ajax
0 5941 posted 4 years ago by cerxx
Here is a code that force to fire a click on iOS devices, where there is first a touchstart event
0 1047 posted 4 years ago by cerxx
JavaScript regex for validating IP addresses, has been tested!
0 876 posted 6 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 905 posted 6 years ago by apphp-snippets
A one-liner that converts a decimal number to a binary number
0 882 posted 7 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 979 posted 7 years ago by heathbo
Detect the OS of mobile device
0 879 posted 7 years ago by envane21
ResponsiveBootstrapToolkit : https://github.com/maciej-gurban/responsive-bootstrap-toolkit
0 832 posted 8 years ago by dhjapan
change the button text on wrong answer
0 812 posted 8 years ago by envane21
Filters a dynamics CRM 2011 subgrid...implementation example included at bottom
0 879 posted 8 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 1263 posted 8 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 838 posted 8 years ago by heathbo
When creating a new https://codepad.co/ snippet, the default language will be set to 'JavaScript'.
0 826 posted 8 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 821 posted 8 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 857 posted 8 years ago by apphp-snippets
Check if the checkbox is checked or not on button click
0 882 posted 8 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 861 posted 8 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 3453 posted 8 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 918 posted 8 years ago by brandonjp
Allows for forname.o'[email protected]
0 774 posted 8 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 959 posted 8 years ago by BrentS
delete Operator don’t impact the length of Array in JavaScript
1 872 posted 8 years ago by ursdeep
« Prev 1 2 3 4 5 ... 65