Skip to:
Content
Pages
Categories
Search
Top
Bottom

Jquery Code for the Text Dissappear in the Whats New Textarea

  • Avatar of lockamiz23
    lockamiz23
    Member

    @lockamiz23

    On buddypress.org, I want to copy the “whats-new” textarea to say “Write Something” in the textbox, than disappear when clicked, but how???

    I know there is already a jquery class for that on the search textbox for the groups, members, and forums, but that is it?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • `hi, follow this example and you should ok

    `

    or just follow this tutorial: http://goo.gl/Wt84G

    This is what I use on my site. Insert this in your post-form.php:

    `$(‘textarea’).each(function() {
    $(this).data(‘default’, this.value);
    }).focusin(function() {
    if ( this.value == $(this).data(‘default’) ) {
    this.value = ”;
    }
    }).focusout(function() {
    if ( this.value == ” ) {
    this.value = $(this).data(‘default’);
    }
    });`

    The above solution will work as well, but the text won’t re-appear if the user clicks off the textarea.

    Forget all that. Use the HTML5 placeholder attribute.

    http://diveintohtml5.org/forms.html#placeholder

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Forget that ;) html5 an unratified proposal don’t forget things may change, behavior is the safe way of handling this, and anyway you would need to switch to a plain Doc Type sans formal identifier.

    You avant guard coders !

    I think that’s mostly rubbish in this day and age. Every decent browser supports placeholder, and a lot of other HTML5 features. HTML’s moved away from a “what’s in this version of the specs” to a “what does your browser support” model.

    Avatar of abyss
    abysshorror
    Member

    @abysshorror

    @virtuali Exactly where in post-form.php should I put that code ?

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.