Make a button show if a sentence :contains (password)
My JS;
- $(document).ready(function(){
- if ($(".wrapfix:contains('password')").length) {
- $(".buttonprotectedbox").removeClass("buttonprotectedbox").addClass("showbutton");
- } else {
- $(".buttonprotectedbox").show();
- }
- });
My html: (its phpbb)
- <div class="wrapfix">
- <div class="buttonprotectedbox">
- <a title="Password Protected Forum." class="ui-button ui-widget ui-state-default ui-corner-all buttonprotected">Protected</a>
- </div>
-
- <!-- IF forumrow.FORUM_DESC --><br /> <span class="forumdesc">{forumrow.FORUM_DESC}</span> <!-- ENDIF -->
- </div>
My CSS;
- .wrapfix {
- display: inline;
- }
-
-
- .buttonprotected {
- display: none;
- }
-
-
- .wrapfix .showbutton {
- display: inline;
- }
So the goal is that when {forumrow.FORUM_DESC} contains the word "password" it will show the protected button.
I think I'm close to getting it to work but what am I missing here?
I don't need jquery to scan the whole forum index just the one row of a forum that has the word password in its description.