Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

26 October 2010

data URIs - MDC

Posted from Diigo. The rest of my favorite links are here.

How to embed small files/data inline with your html document without making a network request?! The solution is using data URL!

22 October 2010

jQuery selector concept

In HTML DOM terms:

Selectors allow you to manipulate DOM elements as a group or as a single node.

jQuery Element Selectors

jQuery uses CSS selectors to select HTML elements.


$("p") selects all elements.
$("p.intro") selects all elements with class="intro".
$("p#demo") selects the first element with id="demo".


jQuery Attribute Selectors

jQuery uses XPath expressions to select elements with given attributes.


$("[href]") select all elements with an href attribute.


$("[href='#']") select all elements with an href value equal to "#".


$("[href!='#']") select all elements with an href attribute NOT equal to "#".


$("[href$='.jpg']") select all elements with an href attribute that ends with ".jpg".

jQuery syntax for selecting HTML elements

The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s).

Basic syntax is: $(selector).action()

  • dollar sign to define jQuery
  • (selector) to "query (or find)" HTML elements
  • jQuery action() to be performed on the element(s)

Examples:

$(this).hide() - hides current element

$("p").hide() - hides all paragraphs

$("p.test").hide() - hides all paragraphs with class="test"

$("#test").hide() - hides the element with id="test"


P.S. jQuery uses a combination of XPath and CSS selector syntax.

06 September 2010

PHP Basics

The most important thing to notice when dealing with HTML forms and PHP is that any form element in an HTML page will automatically be available to your PHP scripts.