0

I have following jquery script

    $('#difoot').click(function (e) {                    
                        $('#visdis').toggle();
                        $('#disfootr').toggle(100);
                        if (!$("#visdis").is(':visible')) {
                            $('#disicon').attr('src', '/PublishingImages/ex1.png');
                        }
                        else {
                            $('#disicon').attr('src', '/PublishingImages/ex2w.png');
                        }
});

which perfectly fine with IOS Safari, and Android browser, but when it comes to windows phone when I click it's going to top of the page, I tried

return false;
e.preventDefault(); 

nothing is working, same thing on any jquery click. I am trying from so many days. If any one could help really appreciated.

closed as off-topic by Robert Lindgren May 22 '14 at 6:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions not specific to SharePoint are off-topic here, but can be asked on Stack Overflow." – Robert Lindgren
If this question can be reworded to fit the rules in the help center, please edit the question.

1

There too many things that can be said about the situation you are facing, especially since you do not provide the HTML and the business logic.

Let me give you some pointers, hoping I could be of some help:

  1. This is not a SharePoint question :-)
  2. Did you check for javascript errors on the Windows Phone? You probably have some.
  3. return false; and e.preventDefault() are not the same. If you want to 'immitate' return false in jquery, you need to use e.preventDefault(); e.stopPropagation(); which will stop the event from bubbling up
  4. Is #difoot a button? Link? Div?
  5. Unfortunately I cannot debug your specific problem, but I know for sure that older versions of IE had a problem with e.preventDefault(). I do not know if this applies to the mobile phone you are using, but to work around it we used the following line (which checks if preventdefault is actually supported, otherwise return Microsoft speak) e.preventDefault ? e.preventDefault() : e.returnValue = false;
  6. Where in the code is the return false or e.preventDefault located? Begining or end?

Hope these can help you...

EDIT: try wrapping your code in try/catch to see if any error messages are displayed and post the related HTML too.

try {
       // your code
    }
catch (err) {
        alert("Error description: " + err.message);
    }
  • Hi, when I try toggle without img change it works, but i try to change img it goes to top. Hope this help you understand my issue. – raky May 21 '14 at 22:45
  • FYI, windows phone we are using is brand new version NOKIA LUMIA 9000 – raky May 21 '14 at 22:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.