Wednesday, August 26, 2009

Limit Text and Strip tags in PHP

$content = $post->post_content;

$limit = 280;

if (strlen($content) > $limit)

$content = substr($content, 0, strrpos(substr($content, 0, $limit), ' ')) . '...';

echo strip_tags($content);

Friday, August 14, 2009

Javascript Validate Number Integer

IsFound = /^-?\d+$/.test($('number').value);


if (IsFound == false) {



$('error_msg').innerHTML = "* Please Enter a valid number.<br>";



}