In Cjax, you can control most HTML objects/elements with the $ajax object. You can also control JavaScript Objects and functions of other scrips. The Main property refers to HTML elements, assigned main property. Cjax can access/modify/remove/add anything from your HTML page, keeping this in mind some times you may wish to only change add, or remove one thing, here is where the main property comes in handy, it allows you to do so with a simple line of code.
Cjax categorizes the a main property on each HTML element. This allows for a speedy interaction with that object while maintaining your code plain and simple.
When you think of an image, what comes to mind first when you think of its main html property?, I'd say it would be "src", when you think of checkbox or a radio button, isn't the value or the check/unchecked the main property?. Think of these tags: a span, a div, p, what would you caracterize their main property? I'd say the innerHTML. That's all this is, is access these properties in the fastest and most convenient way possible so to speed up your development.
Keep in mind, this works with all HTML elements, so think of the limiteless things you can do.
All you need is the element ID and the value you wish to apply. $ajax->[element_id_here] = [value here];
Examples
Change an image. Lets assume there is an image in your html page, and it has the id of, "my_image". You can change the image just by assigning a new image to it. The main property of an image is src. So when you assign a new image url, you are actually changing it's src property.PHP
<?php
$ajax->my_image = 'http://cjax.sourceforge.net/media/logo.png';
?>
Check/Uncheck checkbox. In this example you want to know what is the quickes way to check/uncheck a checkbox, the main property makes it feel like breeze.
PHP
<?php
//check it
$ajax->checkbox_id = true;
//uncheck it
$ajax->checkbox_id = false;
?>
Update a div or a span. Same logic applies to all elements, even divs and span elements.
PHP
<?php
$ajax->my_div = 'Some New HTML here';
$ajax->my_span = 'Some New HTML here';
?>
Change a link URL. For links/anchors the href property is the main property.
PHP
<?php
$ajax->my_link = 'http://cjax.sourceforge.net/';
?>
Element | Main Property | Description |
---|---|---|
Image | src | Any image |
Link | href | Any links |
Checkbox | checked/unchecked | Checkboxes, radios, etc |
Input | value | applies to (text,checkbox,hidden, etc) |
Containers | innerHTML | applies to div,span, p, etc |