Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

jquery popup

Posted on 2012-12-27
2
Medium Priority
?
749 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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 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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

688 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