Bambang pramusintha

Posts Tagged ‘HTML element’

How To Specifying Elements in a Hierarchy

In Hierarchy, JQuery, Plugin, Website Tutorial, Wordpress Tutorial on July 27, 2012 at 9:40 am

As the before topic says that jQuery is great at letting us select a set of elements. But what if you want to select one set in a page, but not another?
Say you have some

ele

ments in a

element that you want to select, but you don’t want to select any

<p> elements outside the <div> element.

One way of selecting the <p> elements we want is by specifying a selector hierarchy. For example, we can ask jQuery to select only those <p> elements that appear inside a <div> element, which itself appears in a <body> element, like this:

$(‘body div p’)

This tutorial will help us to make the selection that we want, and it will also let us change the style class of the selected elements when the user clicks a button, using the following code:

$(‘body divp’).toggleClass(‘striped’);

Steps to Select Elements in a Hierarchy are :

enter the code to add the jQuery library and add four <p> elements in a <div> element and one outside the <div> element, so total five <p> elements.

 

<html>
<head>

<title>Selecting elements in a hierarchy</title>

<script type=”text/javascript”src=”jquery-1.5.1.js”>
</script>

</head>
<body>

<h1>Selecting elements in a hierarchy</h1>

<div>
<p>This is paragraph 1.</p>

<p>This is paragraph 2.</p>

<p>This is paragraph 3.</p>

<p>This is paragraph 4.</p>

</div>

<p>This is paragraph 5.</p>

</body>
</html> Read the rest of this entry »

Advertisements

How to Creating New HTML Elements

In HTML Element, JQuery, Srcipt PHP, Tutorial, Website Tutorial, Wordpress Tutorial on July 27, 2012 at 9:13 am

jQuery help us to create an HTML elements and insert them into a page.

If we pass a text string that spells out a new HTML element to the jquery ( ) or $( ) function (which are the same thing), jQuery will create that new element:

$(“<p>I’m a new &lt;p&gt;element!</p>”)

The upper code will display ”  I’m a new <p> element ! “

To actually get the new element into a page, we have to use a function like insert After () , passing a selector indicating the element that you want to insert the new element after.

This tutorial creates new <p> elements and inserts them into a page following a <p> element with the ID “first”, like this:

$(“

I’m a new <p>element!

”).insertAfter(“#first”);

To create new elements:

1. We are going to use text editor (such as notepad or Wordpad) to create our HTML page and give the file name as “create.html”.

2. Enter the code to add the jQuery libraryand add a element with the ID “first”. Read the rest of this entry »

How to Create a WordPress Plugin

In Plugin, Tutorial, Wordpress Tutorial on July 12, 2012 at 8:52 am

Wordpress plug in logo How to Create a WordPress Plugin so it can be Included in a Theme.

General approach to development is to create discreet features that can interact with each other in elegant ways. By keeping each set of features small, they are simpler by design and implementation – this makes both them less prone to bugs and easier to reuse. You can see this approach in action in many of Crowd Favorite’s WordPress products. For example you can see this sample created Admin Post Formats UI as a library that can be easily reused rather than coding that feature into our FavePersonal theme directly.Another example, Carrington Build includes a plugin to enables translation of it’s data when being pushed from staging to production by RAMP.

Here are some specific things to consider:

  1. Don’t use activation or deactivation hooks. There are actually lots of reasons why these are a bad idea, including multi-site considerations, upgrade considerations, etc. Instead, pick an opportune time to do a lightweight check to see if your plugin set-up needs to be run (perhaps check the existence of one of your settings – perhaps an “installed version” setting) and do the work you need to do at that time. Remember, you want to do these checks in admin hooks rather than front-end hooks – you don’t want to add unnecessary overhead to every public page load and you want to avoid race conditions.2
  2. Don’t reply on your code running prior to all code being loaded. Hook in at wp_loaded (previously this was done at init) to do any set-up work, etc. The only situation where this might not be possible is if you need to override a pluggable function, but the types of plugins that need to do this are (in my experience) less likely to be the type of plugin included in a theme.
  3. Don’t rely on settings existing in the database. This ties in with the first consideration as I often see default settings written to the database as part of the activation process. I take the approach of creating an accessor function in my plugin that holds a set of defaults for settings. Here’s some example code: Read the rest of this entry »

DIV Colors

In Tutorial, Wordpress Tutorial on July 7, 2012 at 10:55 am

Colors

The attribute value type “color” (%Color;) refers to color definitions as specified in [SRGB]. A color value may either be a hexadecimal number (prefixed by a hash mark) or one of the following sixteen color names. The color names are case-insensitive. Read the rest of this entry »

References to HTML elements from a script

In Tutorial, Wordpress Tutorial on July 7, 2012 at 10:50 am

References to HTML elements from a script

Each scripting language has its own conventions for referring to HTML objects from within a script. This specification does not define a standard mechanism for referring to HTML objects.

However, scripts should refer to an element according to its assigned name. Scripting engines should observe the following precedence rules when identifying an element: a

name

attribute takes precedence over an

id

if both are set. Otherwise, one or the other may be used.

18.2.3 Intrinsic events

Note. Authors of HTML documents are advised that changes are likely to occur in the realm of intrinsic events (e.g., how scripts are bound to events). Research in this realm is carried on by members of the W3C Document Object Model Working Group (see the W3C Web Site at http://www.w3.org/ for more information).

Attribute definitions Read the rest of this entry »

%d bloggers like this: