June 20, 2012

javascript regular expression for alphabets and space

js regular expression for alphabets and space Note: A useful javascript function which i mostly use to manage names and related fields validation. function checkName(field,title) { var val = $(“#”+field).val(); var re = /^([a-zA-Z _-]+)$/; if(val.length<1) { $(‘#error_’+field).text(title+’ is required.’); $(‘#error_’+field).addClass(‘error-msg’); return false; } else if(!re.test(val)) { $(‘#error_’+field).text(‘Please enter a valid name.’); $(‘#error_’+field).addClass(‘error-msg’); return false; […]

June 15, 2012

Codeigniter Error Reporting – Intelligent Fix

Codeigniter Error Reporting – Intelligent Fix Description: This little fix will help you to manage the error reporting automatically that if you ever will go online so error reporting will be disabled and when you will import you database in localhost and development phase will be continued so no headache of changing this ENVIRONMENT constant […]

June 14, 2012

How to style placeholders independently?

How to style placeholders independently? :-webkit-input-placeholder { color: #979797; } :-moz-placeholder { color: #979797; } :-ms-input-placeholder { color: #979797; }

June 13, 2012

Linked In Share Button Customization

<a href=”http://www.linkedin.com/shareArticle?mini=true&url={your_url}&title={your_caption}&summary={your_message}&source={your_source}” target=”_new”>Linked In</a> Note: Linked In text can be replaced by image tag or you can customize it in your own way because basic hurdle was the URL you were finding. I will update this post further regarding the POST Image .

June 4, 2012

preg_replace to replace specific tag in string

preg_replace to replace specific tag in string if ( ! function_exists(‘clean_this’)) { function clean_this($tag_name,$html) { return preg_replace(“/(<“.$tag_name.”>.+?)+(<\/”.$tag_name.”>)/i”, ”, $html); } } Keep hyperlink text and remove href $cart_item = ‘<a>’.preg_replace(“/\<a(.*)\>(.*)\<\/a\>/iU”, “$2”, $cart_item).'</a>’;