2009

jQuery: Get the text and value of the selected option of HTML select element

For instance, there’s a HTML select element identified by the ID #title, and after the user has selected one of the options, you want to get the text and value of the selected option. <select id="title"> <option value="1">Mr</option> <option value="2">Mrs</option> <option value="3">Miss</option> </select> Now that the user has selected the 2nd option: Mrs. To get …

jQuery: Get the text and value of the selected option of HTML select element Read More »

jQuery: How to check if an element has a particular class

To know whether a class exists on an element with jQuery, you need a simple test method: is(). For example, to test if an element #elm has the class ‘first’: if ($(#elm).is(‘.first’)) { //#elm has the class } else { //#elm doesn’t have the class } jQuery is() is the function that checks if any …

jQuery: How to check if an element has a particular class Read More »

jQuery: How to test or check whether an element exists

.length property in JavaScript returns the length or number of elements inside an array or the string length. While jQuery selector mechanism $(“elm”) returns an array of DOM objects (such as elements), you can also get the number of the length of the returned objects array by: $("#some").length To check the existence of the element, …

jQuery: How to test or check whether an element exists Read More »

jQuery: Selecting elements with uncommon / special characters in ID or class name

HTML generated by some CMS or frameworks include elements with rather uncommon characters in ID or class names. For example, some may have special characters such as ‘.’ or ‘[..]’ in the ID or Class. To work around this, a selector in jQuery should be written this way: $(“$some.id”) // won’t work for ID: some.id …

jQuery: Selecting elements with uncommon / special characters in ID or class name Read More »

Set Expiration or Expiring Time by mod_expires.c on Apache via .htaccess to Reduce Web Page Loading Time

When your site’s ready in design and majority of common media resources won’t change for quite some time, say, half a year, for example, the images and flashes. It makes sense to set the expiration of them much longer than the default to prevent the client browsers downloading them every time a visitor drops by, …

Set Expiration or Expiring Time by mod_expires.c on Apache via .htaccess to Reduce Web Page Loading Time Read More »

Validate and Check Your Site’s Accessibility against WAI (WCAG) and Section 508

If you are determined to make your site comply with the latest provisions in the accessibility code, you may find it’s a pain in the ass to check point by point against the checklist of WAI (Web Accessibility Initiative) and Section 508. Yep, it sure is with so many check points for your web page …

Validate and Check Your Site’s Accessibility against WAI (WCAG) and Section 508 Read More »

How to know if your hosting provider is overselling on your server?

To check whether you are one of the victims that are dwelling on oversold web hosting servers, you need to have SSH access to your server. Now perform the following commands: cat /proc/cpuinfo | grep processor | wc -l Which will usually return the number of the CPUs of the current server: 2 Then, display …

How to know if your hosting provider is overselling on your server? Read More »

Watch TV and Movies Free Online – The China P2P Internet Streaming Network: PPS

You know what they say, China doesn’t have digital products, instead, it’s all digital freebies because of the lack of legal accountability for intellectual property. A recently released Hollywood blockbuster movie will be pouring into the piracy market at less than $1 per DVD copy. And online? You literally have unlimited access to millions of …

Watch TV and Movies Free Online – The China P2P Internet Streaming Network: PPS Read More »

MySQL: id BETWEEN start AND end Instead of LIMIT start, step For Better Database Performance

Suppose you have a ultra large table of 1 million records and you need to page all those records across 10,000 web pages with 100 records on each page. For page 2, the most straightforward approach is undoubtedly: SELECT * FROM table LIMIT 100, 100 However, this query would introduce performance issues when the starting …

MySQL: id BETWEEN start AND end Instead of LIMIT start, step For Better Database Performance Read More »

Semantic HTML Table Checklist – For The Sake of SEO!

Semantics is the study and practice of introducing meaning to markups, enabling computers to better understand human language. In real world, it is much more than just academics and web standards. Google crawlers and ranking calculators are just the sort of computers dealing with large chunks of text data everyday, reading and analyzing millions of …

Semantic HTML Table Checklist – For The Sake of SEO! Read More »

Why having multiple CSS files is a bad idea?

Just for the sake of code separation and software development paradigms, a lot of web designers and front end developers are tempted to break the CSS styling into a group of separated files based on function. Yours might look like: layout.css typography.css colors.css widget.css While this might look professional at the first glance and generally …

Why having multiple CSS files is a bad idea? Read More »

Linking back to start a war!

While there’s a positive backlink without rel=”nofollow” on an ordinary a tag that adds favorable link juice for the linked site,  and there’s a neutral backlink with rel=”nofollow” that does nothing other than sending some clicking traffic, there should also be a negative backlink that’s meant to be in attacking position to the linked site, …

Linking back to start a war! Read More »

Scroll to Top