riz
riz

Reputation: 23

Jquery mobile Click event is not fired

I have a graph plotted using Floa Graph Lib, and x-axis has 30 points representing days of a month. Each day is a DIV and class name of .tickLabel, if user click on any date, Dialog will appear to fill information related to the date. Following is my code. It works when I test with desktop browser but not in the Phone.

<!-- link button to show dialog. -->
<a data-role='actionsheet' 
   data-sheet='showtrackers' 
   id="as" 
   data-inline='true'></a>


<!-- dialog, this is pop up when user click on x-axis label point. -->
<div id="showtrackers">
   <h3>Heading</h3><hr/>
   Form goes here
   <a data-role="button" data-theme="aa" data-inline="true" style="text-shadow:none">Save</a>
</div>

// .tickLabel is tha class name of each label of x-axis
$($(".tickLabel").click(function(){
   var myText = $(this).text();
   //             change the all x-axis point label color to black
   $(".tickLabel").each(function(){
      $(this).css('color', '#000');
   });

   // highlight the clicked x-axis label point  to orange
   $(this).css('color', '#FAA016');

   // according to clicked x-axis point, pop up shows
   $("#as").click();
}));

Upvotes: 2

Views: 888

Answers (2)

Suzie
Suzie

Reputation: 73

Alternatively if the points are being added dynamically you can use .on() to bind the function.

For example:

$("#as").on("click", function(){alert("clicked");})

Upvotes: 0

Sameera Thilakasiri
Sameera Thilakasiri

Reputation: 9508

Try as follows,

$("#as").tap();

tap - triggered after a tapping an pnscreen element.

jQuery Movile Events

Upvotes: 3

Related Questions