简体   繁体   中英

jquery and DOM element click function

I have a problem with a DOM element that is not recognized by jQuery.

The site is:

http://www.italartsofas.it/collection2012/

I need to add a function to turn the pages when it is clicked. The function works on the div with class "prima" and "ultima" through this script:

$ (". prima"). click (function () {
     $ ('# magazine'). turn ('page', 1);
});

$ (". ultima"). click (function () {
     var pagine = $ ('# magazine'). turn ('pages');
     $ ('# magazine'). turn ('page', page);
});

In fact, clicking on "Prima pagina" and "Ultima pagina" script works.

The moment I try to run it on the link "First" with class "jPag-first" pages do not change.

Here's the script:

$ (". jPag-first"). click (function () {
     $ ('# magazine'). turn ('page', 1);
});

Perhaps because the contents of the div # demo1 is created using jQuery and it is not already existing in the HTML?

You need to remove space here:

$(". prima")
$("# magazine")

Should be:

$(".prima")
$("#magazine")

There should be no space between class/id identifiers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM