I'm creating a mobile site for a client and I need to create a function to show and hide a DIV element when a button(a tag) is pressed. This is my code:
<script type="text/javascript">
$('#wrapper').live( 'pageinit',function(event){
$("#btnInfo").click(function(){
$("#pageInfo").toggle();
});
});
</script>
What happens is: When the page loads and i press btnInfo, the div shows up, works like it should but then i press on a link to go to the next page but on that page it does not show up anymore, whenever when i go back to the page i loaded at first it still works. I think this is because the page is loaded in AJAX, which i want it to be. I searched for a fix and i found: http://jquerymobile.com/test/docs/api/events.html and jQuery Mobile - binding to pageinit event tried it both, and the alert shows up when i switch pages but the function i wrote does not work
what do i do wrong?
Greetings, Harm.