Call me old fashioned. I started using JavaScript in the 90s before jQuery was even an idea. Sure, I can troubleshoot jQuery, and it is used a lot in Drupal, but my first impulse is to write regular JavaScript, which still works too. I think jQuery is the best JS framework, I've worked with prototype.js, mootools etc. too.
But when I wanted to hide an obscure and possibly meaningless warning message on the user account edit page (so that new members would not get freaked and think they did something wrong) I struggled.
First I hacked the user.module and although I removed the warning I also gave everybody admin access, including people who are not even logged in - not a good idea.
So I used CSS to hide the warning messages on "body-page.user" which seemed to do the trick.
Then my client told me he was having trouble creating new accounts, and I realized that I hid ALL user module warnings including "User name xxxx already exists" so I was back with the ugly warning.
Finally, I decided to hide just the warning with the text in question. Sure, I could have done it with classic JavaScript, indexing through all the div elements and looking for the matching innerHTML text and hiding the div. I guess that would have been about 8 lines of code.
I decided to figger out the best jQuery method. I came up with one line of jQuery code to add to my theme template that did the trick:
<script type="text/javascript">$("div.messages:contains('Illegal offset type in isset or empty')").hide();</script>
(note: the .messages selector is crucial; without it, all divs that are parents of the warning are also hidden, effectively hiding the entire page!)
thanks, jQuery...
now about that PHP warning...
learn jQuery at W3Schools
Recent comments
2 weeks 1 day ago
2 weeks 1 day ago
2 weeks 1 day ago
2 weeks 1 day ago
2 weeks 1 day ago
52 weeks 6 hours ago
1 year 5 hours ago
1 year 6 hours ago
1 year 15 weeks ago
1 year 16 weeks ago