Jan 26, 2017

[Solution] Call Method Once Flip Is Done - jQuery-Flip

Question

 am using a Flip Plugin
I have been trying to call a method once the flip is done/completed, but the method is getting called even before the flip is done.completed.
$("#card").flip('toggle');
$("#card").on("done", ChangeWord());
Let me know where i am going wrong ?
Answere 
Your answer is in the link you posted in the question under the 'Events' heading. Specifically, the flip:done event. Also note that you need to pass the reference of the ChangeWord() function to the event handler, not its return value. Try this:
$("#card").on('flip:done', ChangeWord).flip('toggle');
Alternatively the flip() method accepts a callback function to be executed when the animation completes:
$("#card").flip('toggle', ChangeWord);

$("#card").flip('toggle', ChangeWord); this worked out fine as this will happen only when i use it , but $("#card").on('flip:done', ChangeWord).flip('toggle'); will call the method every time it flips 

Jan 22, 2017

[Solution] jQuery: How to capture the TAB keypress within a Textbox

Problem : 
  • I have a text box which is an ajax auto complete,so when i select a record i save an id into         a hidden variable.
  •  And there is a keydown event on that text box, if key down i delete the hidden variable             value.  because i don't want the user to enter any thing after he selects from the  autocomplete.
  • Now even when i press the tab button the hidden variable is cleared. 
  • Is there a way to avoid only Tab press event.?
Answer :
  • When the tab is pressed you have to read if the keydown was from the Tab button, if so you can avoid it..
$("body").on('keydown', '#textboxId', function(e) { 
  var keyCode = e.keyCode || e.which; 

  if (keyCode == 9) { 
    e.preventDefault(); 
    //IF Tab Pressed You Can Do Anything Here
  } else{ //If Its Not Tab, You Can Do It Here }
});
                


[Fixed Solution] Jquery autocomplete not working inside the ajax updatepanel

Issue : I have some auto complete text boxes with ajax calls within update panels in asp.net.
           Initially the update panel will be hidden , but when i make the visible true, 
           the autocomplete ajax controls will not work. is there a way to initialize it again after a update            panel is visible.?

Answer : Yes, there is a way. The update panel replaces the content of update panel on its update this                  means you have new content in the update panel. So the solution is to rebind the jQuery                      events like this:


Solution :  
<script type="text/javascript">
        $(function () {
            initializer();
        });


        var prmInstance = Sys.WebForms.PageRequestManager.getInstance();


        prmInstance.add_endRequest(function () {
            //you need to re-bind your jquery events here
            initializer();
        });
        function initializer() {
            $("#<%=txtrefmastguage.ClientID%>").autocomplete('Handlerold.ashx', { minChars: 1, extraParams: { "param1": "1"} })
            .result(function (event, data, formatted) {
                if (data) {


                    $("#<%= hidrefguagecode.ClientID %>").val(data[1]);
                }
                else {
                    $("#<%= hidrefguagecode.ClientID %>").val('-1');
                }
            });


        }
  

    </script>

JWT Token Decode Using Jquery

When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...