Skip to main content

Posts

Showing posts from February 27, 2011

Fwd: disable or enable some elements in Jquery

Sometimes you need to disable or enable some elements in your document and jQuery makes this task easy. All you have to do is to set disabled attribute to " disabled ". Example:     // To disable     $('.someElement').attr('disabled', 'disabled'); In order to enable any disabled element you need to set the disabled attribute to empty string or remove it entirely like in the code below.     // To enable     $('.someElement').removeAttr('disabled');           // OR you can set attr to ""      $('.someElement').attr('disabled', '');

Highcharts Interactivecharts for your web page. : Free

http://www.highcharts.com/ Interactive JavaScript charts for your web page. Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.

Css: Padding : one, two and three values given?!

If four values are given, they apply to top, right, bottom , and left padding, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side. For example, the following rule sets : p { padding: 2em 4em 5em } the top padding to 2em,  the right padding to 4em, the bottom padding to 5em, and the left padding to 4em:

PHP String Crop

Useful little function that finds and returns a chunk of a string between point A and point B.. function crop( $d='', $b='', $e='' ) { return substr( $d, strpos( $d, $b )+strlen( $b ), strpos( $d, $e, strpos( $d, $b ) )-strpos( $d, $b )-strlen( $b ) ); } $str = "some random STRING with some html in it."; echo crop( $str, ' ', ' ' ); // should output "html"