0

I have a button with slide transition hyperlink.

<a href="register.html" data-transition="slide"><img src="images/enter_btn.png"  width="82" height="82" /></a>

While the page slide to register.html, in ready function, I have added a log text to check.

$(document).ready(function() {
 console.log('here');
});

But above code is not printing the text. When I reload the page again, it prints the log text. Why is that?? Help me on this.

Thanks

Amir
  • 1,328
  • 2
  • 13
  • 27
DarkRose
  • 125
  • 4
  • 12

1 Answers1

-1

Slide Property which is you are using is only for slide purpose, in this situation your DOM is not reload. So you have put your code on onclick function of that a tag.

Suhas Gosavi
  • 2,170
  • 19
  • 40
  • without document ready on register.html, how can i use onclick function? – DarkRose Dec 11 '13 at 09:31
  • you can add JS in your Head of HTML, and put your code over in that JS file. – Suhas Gosavi Dec 11 '13 at 09:54
  • $(document).on('pagebeforeshow', '#register', function(){ alert('Page One'); }); – Suhas Gosavi Dec 11 '13 at 09:56
  • Like above way you can call. or else i dont know what you are doing because i dont have your code. – Suhas Gosavi Dec 11 '13 at 09:59
  • 1
    Refer this question :- http://stackoverflow.com/questions/15430912/page-loaded-differently-with-jquery-mobile-transition – Suhas Gosavi Dec 11 '13 at 10:01
  • Thanks for the link.."In case of multiple HTML files, HEAD is only loaded in the first HTML file. In other files, only a BODY content is loaded. This is because AJAX is used to load other pages into the DOM. Because there's already a HEAD content inside an original DOM only a body will be loaded from the other pages." === i have added my js inside body and it works – DarkRose Dec 11 '13 at 13:22
  • @stupid If you got the solution then kindly mark it as helpful answer. – Furquan Khan Dec 11 '13 at 14:16