Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

jquery popup

Posted on 2012-12-27
2
Medium Priority
?
755 Views
Last Modified: 2012-12-27
I have followed the example at:
http://jquerymobile.com/demos/1.2.0-alpha.1/docs/pages/popup/popup-panels.html

I have managed to implement the popup and it works well, but I am new to jquery and cannot work out how to catch the click event in the buttons. I have placed the code for the  popupbeforeposition: function in script tags and this works I have tried placing data-click events in the buttons mark up  and adding custom code in the script tags but this never fireshow do I capture the events?

mark up:

<a href="#popupPanel" data-rel="popup" data-transition="slide" data-position-to="window" data-role="button">Open panel</a>
                  
<div data-role="popup" id="popupPanel" data-corners="false" data-theme="none" data-shadow="false" data-tolerance="0,0">

    <button data-theme="a" data-icon="back" data-mini="true">Back</button>
    <button data-theme="a" data-icon="grid" data-mini="true">Menu</button>
    <button data-theme="a" data-icon="search" data-mini="true">Search</button>
      
</div>

<script>
 $( "#popupPanel" ).on({
    popupbeforeposition: function() {
        var h = $( window ).height();

        $( "#popupPanel" ).css( "height", h );
    }
});
</script>
0
Comment
Question by:JoeBo747
2 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 2000 total points
ID: 38723307
First, assign IDs to buttons:

<button id="buttonBack" data-theme="a" data-icon="back" data-mini="true">Back</button>
<button id="buttonMenu" data-theme="a" data-icon="grid" data-mini="true">Menu</button>
<button id="buttonSearch" data-theme="a" data-icon="search" data-mini="true">Search</button>

And then you can do the following:
$('#buttonBack').click(function() {
    //your code here
});

Hope that helps.
0
 
LVL 1

Author Closing Comment

by:JoeBo747
ID: 38723423
Hi Roland,
Thanks for the help, should have spotted the missing ID!
Regards
Joe
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question