Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hello, i've a stuck question where, the jquery .click() function did not working properly.
the scenario is like this,
when i click at my textbox, the bottom bar is show up, this is my jquery function to run it

XML
$j(document).ready(function ($) {
                                            //$j("#tblPostGodsFeed").hide();
                                            $j('#<%= txtShout.ClientID %>').bind('click',function ($) {
                                                $j("#tblPostGodsFeed").show();
                                            });
                                        });

when i click it, it won't show up, but when i double click the textbox it showed up ? how can i do it ?


and also this, when i've an action button, and click the action button, it must dropdown the box, when i've click it, the dropdown didn't show up, but when i double click the drop down it just show up.


is there something wrong with my jquery?
Posted
Comments
Namith Krishnan E 20-Jun-14 7:43am    
do u using update panel in this page?
Andrew Budiman 20-Jun-14 8:50am    
yes i'm using updatepanel, is that wrong sir ?
Namith Krishnan E 23-Jun-14 3:35am    
?

Please try as shown below.Use 'on' instead of bind and put the return false at the end of the event as shown below.

PHP
$j(document).ready(function ($) {

   $j('#<%= txtShout.ClientID %>').off('click').on('click', function(){

         $j("#tblPostGodsFeed").show();

         return false; //to prevent the browser actually following the links!

       });
});
 
Share this answer
 
v2
Comments
Thanks7872 20-Jun-14 8:41am    
Why to remove and add click again? off removes the handler added using on. Its not required.
Sampath Lokuge 20-Jun-14 8:51am    
This will be eliminated the click the button twice. :)
Try including the entire page in content template of ur update panel including the script.It will work
 
Share this answer
 
Hi Did you try

JavaScript
$j(document).ready(function ($) {
    //$j("#tblPostGodsFeed").hide();
   $j('#<%= txtShout.ClientID %>').on('focus',function ($) {
                                                $j("#tblPostGodsFeed").show();
                                            });
                                        });
 
Share this answer
 
but when i'm using this code, it can't work
PHP
$j(document).ready(function ($) {
                $j('div.dropdown').each(function () {
                    var $dropdown = $j(this);
                    $("a.dropdown-link", $dropdown).on('focus',function () {
                        $div = $('div.dropdown-container', $dropdown);
                        $div.show();
                        $('div.dropdown-container').not($div).hide();
                        return false;
                    });
                });
                $j('html').click(function ($) {
                    $j('div.dropdown-container').hide();
                });
            });
 
Share this answer
 
Comments
VICK 23-Jun-14 0:44am    
To reply to any of the comments or to post a comment on your own question.. use "Have a question or comment" option.. rather than adding a new solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900