-
Notifications
You must be signed in to change notification settings - Fork 20
Query ToggleClass
Thomas Weinert edited this page Jul 31, 2014
·
1 revision
FluentDOM\Query toggleClass(string|callable $class [ NULL|boolean $switch ]);
Adds the specified classes if the switch is TRUE, removes the specified classes if the switch is FALSE, toggles the specified classes if the switch is NULL.
$html = <<<HTML
<html>
<head>
<title>Examples: FluentDOM\Query::toggleClass()</title>
</head>
<body>
<p class="blue">foo</p>
<p class="blue highlight">bar</p>
</body>
</html>
HTML;
echo FluentDOM($html)
->find('//p')
->toggleClass('highlight');
<?xml version="1.0"?>
<html>
<head>
<title>Examples: FluentDOM\Query::toggleClass()</title>
</head>
<body>
<p class="blue highlight">foo</p>
<p class="blue">bar</p>
</body>
</html>
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces