Last active
December 31, 2015 20:49
-
-
Save KryptikOne/8043162 to your computer and use it in GitHub Desktop.
This tests whether the <body> has a certain class, and if it does, it finds a child within a parent and appends the placeholder attribute to the child.
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
| (function($){ | |
| var someParentElement = $('#id_of_parent'), | |
| someChildElement = $('#id_of_child'), | |
| theBodyElement = $('body'); | |
| if(theBodyElement.hasClass('some_class_on_the_body_element')) { | |
| someParentElement.find(someChildElement).append(function(){ | |
| $(this).attr('placeholder', 'Your Placeholder Text'); | |
| }); | |
| } | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment