jQuery4PHP Current Release: v1.7.0 - Stable

jQuery version: v1.8.2

jQueryUI version: Stable (1.8.24: jQuery 1.3.2+)

jQuery4php API

Manipulation

Hide navigator Hide source code

All of the methods in this chapter manipulate the DOM in some manner. A few of them simply change one of the attributes of an element (also listed in the Attributes category ), while others set an element’s style properties (also listed in the CSS category ). Still others modify entire elements (or groups of elements) themselves—inserting, copying, removing, and so on. All of these methods are referred to as “setters,” as they change the values of properties.
A few of these methods—such as .attr() , .html() , and .val() —also act as “getters,” retrieving information from DOM elements for later use.

ToggleClass

Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
<input type="button" value="Toggle Class" id="btnToggleClass" />
<div align="center">
<table id="tblToggleClass">
  <tr><td>Lorem ipsum dolor sit amet</td></tr>
  <tr><td>consectetur adipisicing elit</td></tr>
  <tr><td>sed do eiusmod tempor incididunt ut</td></tr>
  <tr><td>labore et dolore magna aliqua</td></tr>
  <tr><td>Ut enim ad minim veniam</td></tr>
  <tr><td>quis nostrud exercitation ullamco laboris</td></tr>
  <tr><td>nisi ut aliquip ex ea commodo consequat.</td></tr>
</table>
<?php
echo
YsJQuery::newInstance()
  ->onClick()
  ->in('#btnToggleClass')
  ->execute(
    YsJQuery::toggleClass('even')->in('#tblToggleClass tr:even'),
    YsJQuery::toggleClass('odd')->in('#tblToggleClass tr:odd')
  )
?>
</div>

Lorem ipsum dolor sit amet
consectetur adipisicing elit
sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua
Ut enim ad minim veniam
quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.

Comments

  • Support requests, bug reports, and off-topic comments will be deleted without warning.

blog comments powered by Disqus

About

Demos

jQueryUI

Plugins Support - New!

Components - New!

Project Developed by The YepSua Team
SourceForge.net