Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
hiding form problem (jquery)
Old 01-22-2011, 07:58 AM hiding form problem (jquery)
Super Talker

Posts: 134
Trades: 0
i have a form that is hidden by default. (not really a form, but a div with a textarea and a button)

if you click on a link this form becomes visable. (working)
if you hit the submit button the content of the form is processed and the form becomes invisible again. (working)

now i want that the form becomes invisible when the user clicks outside the textarea without submitting the form.

i'm using the blur function, but i cannot submit anything anymore.

How can i fix this.
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-22-2011, 07:35 PM Re: hiding form problem (jquery)
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Not sure I understand what you're asking. Can you post the code.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 01-23-2011, 05:57 AM Re: hiding form problem (jquery)
Super Talker

Posts: 134
Trades: 0
Quote:
Originally Posted by PaulW View Post
Not sure I understand what you're asking. Can you post the code.
this is the html code

Code:
<div>
  <a href="#" class="quick_comment">+Comment</a> | <a href="#" class="dolike">Like</a>
   <div class="quick_comment_form" style="display:none;">
    <table border="0"><tr><td valign="top">
    <img src="****************" width="25" height="25" />
    </td><td>
    <textarea name="message" rows="2" class="fpost commentmessage""  style="width:350px;" ></textarea>
    <input type="button" value=" Comment " class="fbutton commentsubmit" />
    </td></tr>
    </table>
   </div>
   <input type="hidden" name="wall_id" value="1" />
   <div></div>
  </div>
and this the jquery code

Code:
    <script>
    $(document).ready( function(){
      
      $(".commentmessage").blur(function() {
       var thiscomment = $(this).parents(".quick_comment_form");
                 thiscomment.hide(); 
       });
      $(".quick_comment").click(function() {
        $(this).next().next().css("display","block");
        $(this).next().next().find(".commentmessage").focus();
        return false;
      });
      $(".commentsubmit").click(function() {
       
       if ($(this).prev()[0].value != "") {
        var thiscomment = $(this).parents(".quick_comment_form");
        var cbox = thiscomment.next().next();
        var mbox = thiscomment.find(".commentmessage");
        var tbox = thiscomment.next();
        cbox.html("<img src=\"*****************" /> Submitting");
        $.post("*****************",
        {message:mbox[0].value,target_id:tbox[0].value},
          function(data){
         cbox.html("");
         cbox.after(data);
         mbox.attr("value","");
         },"html"
        );
        return false;
       }
      });
      
      $(".dolike").click(function() {
       var thiscomment = $(this).next();
       var cbox = thiscomment.next().next();
       var tbox = thiscomment.next();
       cbox.html("<img src=\"**********************\" /> Submitting");
       $.post("********************",
       {target_id:tbox[0].value},
         function(data){
        cbox.html("");
        cbox.after(data);
        },"html"
       );
       $(this).css("display","none");
       return false;
      });
    });
    </script>
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to hiding form problem (jquery)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32749 seconds with 12 queries