CRecordWebAddClassesToElement
The message
The message is part of the
The API is located in the plugin NY_
{ "id": "03e06095-b433-4411-b7e8-ee796265bd08", "name": "WEB_ADD_CLASSES_TO_ELEMENT ", "description": "Add classes to an HTML element.", "slots": [ { "key": "1", "name": "SELECTOR ", "direction": "REQUEST", "mandatory": "true", "type": "STRING", "description": "The selector." }, { "key": "2", "name": "CLASS ", "direction": "REQUEST", "mandatory": "true", "type": "STRING", "description": "The class to add." }, { "key": "3", "name": "CLASSES ", "direction": "REQUEST", "mandatory": "true", "type": "STRING_ARRAY", "description": "The classes to add." } ] }
Arguments
-
SELECTOR : A selector for identifying the HTML element, e.g.#id_my_element
for an ID or.my_class
for a class. Several elements can be changed at once. -
CLASS : An HTML class to be added to the element. Use this slot if only one class is to be added. -
CLASSES : An array of HTML classes to be added to the element.
Usage with the helper class CWebApi
The easiest way is to call the corresponding method in the CWebApi class. The use of the class is described there.
mWebApi.addClassToElement("#id_my_element" ,"class1" );
or
mWebApi.addClassesToElement("#id_my_element" ,Arrays.asList(new String[]{"class1","class2"}) );
Usage as message
The
public voidaddClassesToElement (@NotNull final CTargetAddressa , @NotNull final StringRemote Skin AddressaSelector , @NotNull final StringaClass ) throws CException {// Envelope final CEnvelope env = CEnvelope.forSingleTarget(m );Remote Skin Address// Record final CRecord record =CRecordWebAddClassesToElement .create();CRecordWebAddClassesToElement .setSelector(record,aSelector );CRecordWebAddClassesToElement .setClass(record,aClass );// send message sendNotification(env, record); }