-
Equalize heights of elements with jQuery
-
Easily truncate content with fade out and Read More button
-
Preload an array of images by data attribute
-
Disallow File Uploads over 2Mb (or any size)
A quick and easy jQuery snippet to find all file upload inputs & make sure users don’t upload files that are too large. Just include in your $(function(){ }); function $(‘input[type=file]’).each(function(){ $(this).on(‘change’, function() { //this.files[0].size gets the size of your file. if (this.files[0].size > 2097152 || this.files[0].filesize > 2097152) { alert(‘Your file is too large…
-
WordPress Import Posts – Assign to Existing Author
When importing posts, pages, or custom posts from an existing WordPress installation, it asks you whether you want to import a user, assign to a new user, or assign to an existing user. If you have already imported users, you want to assign all posts to existing users. However, if you have a lot of…
-
Hijack form action & interact with page using jQuery
To create a widget that takes a user’s input of Postcode, compares it against an array of postcodes, and acts on the page telling the user whether their postcode is valid or not, you can start with the following code: <div id="MyForm"> <form method="POST" name="info-form"> <input type="hidden" value="/form-sent" name="returnURL" /> <label for="First Name">First Name: </label>…
-
jQuery iOS-like App-Folders
-
jQuery – Captcha/Anti-Spam without PHP or Server-Side code
-
Convert Table to Divs with jQuery
Dynamically converting a table, table row (tr), or table cell (td) to be div-based may seem difficult, but it’s surprisingly simple, if you have a div in each cell containing all its content. Rather than replacing the table, tr or td tags with div, you can use jQuery to create an element after the table,…
-
Click a Heading to reveal sub-content
HTML is a markup language that, most essentially, sets the structure of a document. That structure is meaningful, and it’s often abused when web developers do a sloppy job. It’s important for accessibility, readability, and in giving a clear understanding of what is what. With that in mind, I set out to create a page full…