Css/Html Class-Names

Ajax Response Class-Names on Html-Attributes

Set some class-names with ajax to an html-element

replace the perhaps existing old class name with the newer one

Factory::getResponseInstance()->classSet('htmlElementId', 'myClass anOtherClass');

Add an class name with ajax to an html-element

Factory::getResponseInstance()->classAdd('htmlElementId', 'myClass');

Add some class-names with ajax to an html-element

Factory::getResponseInstance()->classAdd('htmlElementId', 'myClass anOtherClass');

Remove an class-name with ajax from an html-element

Factory::getResponseInstance()->classRemove('htmlElementId', 'myClass'); 

Remove class-names with ajax from an html-element

(order of class names doesn't matter.)

Factory::getResponseInstance()->classRemove('htmlElementId', 'anOtherClass myClass ');

Clear all class-names with Ajax from an html-element


As Jybrid-script javascript className

Also you can use class name handling in your javascript files like in other javascript-frameworks.

jybrid.classAdd javascript add an className to an html-element
jybrid.classAdd javascript adding more than classNames to an html-element
jybrid.classAdd('htmlElement','an_class an_other_class')
jybrid.classRemove javascript remove specific className from an html-element

try to remove an class from html-attribute (if the className exists)

jybrid.clear javascript Clear alle classNames from an html-element

Empties an className completely


old xajax was xajax.assign()


Remove some class names from an html-attribute

<span id="someClasses" class="selected active iamLoggedIn greening"></span>
// Ajax Response
Factory::getResponseInstance()->classRemove('someClasses', 'greening active ');
// javascript direct
jybrid.classRemove('someClasses', 'greening active ');

live-demo ajax className

@see schematic-ajax-classNames.php

further reading ajax css className examples

@see simple schematic ajax-classNames