Unobtrusive Dropdown Page Changer

Using a <select> dropdown menu to create navigation isn’t as common as it once was, but it’s still around. It got ripped on pretty good for being an inaccessible / obtrusive. Indeed a lot of the scripts you’ll find out …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Simple Zipcode Range Tester

This regex below tests the provided zip code if it starts with the numbers 096 and that there are exactly 2 numbers after it. If it does, it echos Yes, if not, it echos No. In this test case, it …

Avatar of Chris Coyier
Chris Coyier on

Add (+/-) Button Number Incrementers

Text inputs on forms can be used to submit numbers. A common use would be a “quantity” input on an eCommerce site. Changing the quantity value, from the user’s perspective entails tabbing or clicking to the input, deleting it’s current …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Recent Posts Function

Technique #1

This function is useful when you need to display content, excerpt, custom fields, or anything related to the post beyond it’s link and title. If you just need a list of linked titles, see the next technique. Put …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

PHP Array Contains

Check if value is in array and outputs Yes or No

<?php
$names = array( 'Bob', 'Jim', 'Mark' );
echo 'In Array? ';
if (in_array(‘foo’, $names))
   echo 'Yes';
else
   echo 'No';
?>
Avatar of Chris Coyier
Chris Coyier on

Example Form Markup

<form id="myForm" action="#" method="post">

  <div>
    <label for="name">Text Input:</label>
    <input type="text" name="name" id="name" value="" tabindex="1">
  </div>

  <div>
    <h4>Radio Button Choice</h4>

    <label for="radio-choice-1">Choice 1</label>
    <input type="radio" name="radio-choice" id="radio-choice-1" tabindex="2" value="choice-1">

    <label for="radio-choice-2">Choice 2</label>
    <input type="radio" name="radio-choice" id="radio-choice-2" tabindex="3" value="choice-2">
  </div>

  <div>
    <label 
Avatar of Chris Coyier
Chris Coyier on (Updated on )

Empty Table Markup

<table>
	<thead>
		<tr>
			<th></th>
			<th></th>
			<th></th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
		</tr>
	</tbody>
</table>
Avatar of Chris Coyier
Chris Coyier on