Created
December 3, 2011 13:58
-
-
Save traineed/1427189 to your computer and use it in GitHub Desktop.
jQuery Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('p').css('font-size'); //Manipulates CSS | |
| $('p:first').toggleClass('bigger'); // Adds & removes Class Bigger | |
| $('p:first').hide(); | |
| $('p:first').show(); | |
| $('p:first').toggle(); // toggles between Hide and Show | |
| $('p').text('abcd'); //Strips HTML | |
| $('p').html('<b>abc</b>'); //includes HTML | |
| $('p').prepend('abcd'); //Adds to start of p | |
| $('p').append('abcd'); //Adds to start end p | |
| $('p').before('<h1>abcd<h1>'); //Adds sibling before selection | |
| $('p').after('<i>abcd<i>'); //Adds sibling after selection | |
| $('p:first').remove(); // removes object from the DOM |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function
.text >> without parameter query the plain text / with parameter set the plain text
.html >> without parameter query html and text / with parameter set html and text
.prepend >> add element inside the beginning of the selectionadd element inside the beginning of the selection
.append >> add element inside the end of the selectionadd element inside the end of the selection
.before >> add element before selectionadd element before selection
.after >> add element after selectionadd element after selection
.remove >> remove element from the DOM