[fx.php_list] Re: [off] Jquery issue

  • From: Bob Patin <bob@xxxxxxxxx>
  • To: "FX.php Discussion List" <fx.php_list@xxxxxxxxxxxxx>
  • Date: Sun, 12 Feb 2017 14:24:17 -0600

Finally figured things out; I was using a class called “content” and it was 
conflicting all over the place.

New question:

When I invoke the date picker, I want to trigger a 2nd function; the date 
picker’s code looks like this:

$('#datetimepicker').datetimepicker({
        pickTime: false, 
        language: 'en'
});

How do I embed a 2nd function, like a simple alert()?

B




On Feb 11, 2017, at 2:41 PM, Bob Patin <bob@xxxxxxxxx> wrote:

Actually, the first single-quote *was* an apostrophe, so that fixed it, but…

It still doesn’t allow the alert to show when I go to the 2nd page…

Very odd. 


On Feb 11, 2017, at 2:39 PM, Bob Patin <bob@xxxxxxxxx 
<mailto:bob@xxxxxxxxx>> wrote:

I think it was just curly versus straight quotes… still testing, but 
double-quotes at least lets the page load. Now to see if it solves my issue.

I’ve always used this format without any trouble

$('.content').delegate('.category', 'click', function(){

but is this not the best way to do it?

B


On Feb 11, 2017, at 2:36 PM, Dale Bengston <dale.bengston@xxxxxxxxx 
<mailto:dale.bengston@xxxxxxxxx>> wrote:

Did my email editor make some of the quotes into apostrophes?

Dale

On Feb 11, 2017, 3:35 PM -0500, Bob Patin <bob@xxxxxxxxx 
<mailto:bob@xxxxxxxxx>>, wrote:
Hey Dale,

There must be a syntax error in these—it causes my JQuery to fail.

Can you take a gander at it and see if you left anything out?

B


On Feb 11, 2017, at 2:27 PM, Dale Bengston <dale.bengston@xxxxxxxxx 
<mailto:dale.bengston@xxxxxxxxx>> wrote:

Hi Bob,

Binding a click function can be an issue if the element doesn’t exist 
when the page loads. So, if your dates piece isn’t working, perhaps you 
can back the function out to work on anything in the page, regardless of 
when it loads. The syntax I use is

$(document).on(‘click', ‘.bookthis', function() {
 $('.content').load(‘dates.php');
 return false;
});

$(document).on(‘click', ‘.category', function() {
 $('.content').load(‘activity.php');
 return false;
});

Dale

On Feb 11, 2017, 2:48 PM -0500, Bob Patin <bob@xxxxxxxxx 
<mailto:bob@xxxxxxxxx>>, wrote:
OK, this seems so simple, but I’m stumped:

INDEX page contains all my JQuery; all of the subsequent pages load into 
a “content” DIV:

CATEGORY page loads; click button, which loads an ACTIVITY page;
click button, which loads a DATES page

Very simple stuff.

When the DATES page loads, a function needs to fire so that I can set up 
a date picker, but it doesn’t ever run.

To test, I put this code into the ACTIVITY page:

<script type="text/javascript">
$(document).ready(function(){
alert('test');
});
</script>

As you would expect, I get an alert when the ACTIVITY page loads.
Then, when the DATES page loads, I put in the exact same code, but it 
never runs.

Both pages are loaded using a simple line (here they are, with 
extraneous stuff omitted):

// ACTIVITY
$('.content').delegate('.category', 'click', function(){
$('.content').load(‘activity.php');
return false;
});
// BOOK THIS
$('.content').delegate('.bookthis', 'click', function(){
$('.content').load(‘dates.php');
return false;
});

SO, my question is this: why does my alert fire on the first event 
(ACTIVITY) but not the 2nd?
I even put a super-simple DATES.PHP page up, with one word on it, and 
then the alert code.

If someone can help me with this, I’d be really thankful; I’ve stared at 
it all morning and can’t see anything amiss.

Thanks,

Bob Patin
Longterm Solutions
bob@xxxxxxxxxxxxxxxxxxxxx <mailto:bob@xxxxxxxxxxxxxxxxxxxxx>
615-333-6858
FileMaker 9, 10, 11, 12 & 13 Certified Developer
http://www.longtermsolutions.com ;<http://www.longtermsolutions.com/>
-
iChat: bobpatin@xxxxxx <mailto:bobpatin@xxxxxx>
Twitter: bobpatin

FileMaker Consulting 
FileMaker Hosting for all versions of FileMaker
PHP • Full email services • Free DNS hosting • Colocation • Consulting







Other related posts: