Guess, you shouln't use attr('value'). Just use .val('Default text')

You've mixed up value of textarea and attribute named “value”.

On Dec 27, 3:30 pm, Giri <dasthag...@gmail.com> wrote:
> Here is my jascritpt code
> <script language="text/javascript">
>   //<![CDATA[
>
>  jQuery(document).ready(function() {
>
>     jQuery('#text-area-id').blur(function() {
>         if (jQuery(this).val() == '') {
>             jQuery(this).attr('value', 'Default Text');
>         }
>     });
>     jQuery('#text-area-id').focus(function() {
>         if (jQuery(this).attr('value') == 'Default Text'') {
>             jQuery(this).val('');
>         }
>     });}
>
> //]]>
> </script>
>
> I am showing 'Default Text' in text area, and when focus is there it
> will clear the text area and shows empty text area for user input, and
> on Blur it will reset to "Default Text" if the input is empty. This
> whole javascript is in model dialog. This works only one time , ie.
> first time when DOM is loaded, and following invocations it failed
> invoke blur and focus. Please let me know what is issue with this
> approach.

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to