-
Equalize heights of elements with jQuery
jQuery function to equalize heights of a set of elements. HTML structure for example call: div.equalize>div*4 View the code on Gist.
-
Easily truncate content with fade out and Read More button
View the code on Gist.
-
Preload an array of images by data attribute
View the code on Gist.
-
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
I’ve created a jQuery plugin for displaying information in “Shelves” or “App-Folders” like the folders on an iPhone’s home screen full of app icons. It’s called jQuery App Folders and it’s also available on Github. Take a look!
-
jQuery – Captcha/Anti-Spam without PHP or Server-Side code
In some cases, you won’t have access to server-side code for your forms, and when you need to add a form submitting to an off-site domain you may need anti-spam for sanity’s sake. Caution: in order to use this method, you need to require users to have JavaScript enabled. This is a risk, as about…
-
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…