0

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?

2
  • api.jquery.com/category/selectors Commented Jun 19, 2012 at 10:52
  • why are giving space between '.' ,'#' selectors and Ids. There should not be any white space between both. Commented Jun 19, 2012 at 11:00

1 Answer 1

1

You need to remove space here:

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

Should be:

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

There should be no space between class/id identifiers.

Sign up to request clarification or add additional context in comments.

1 Comment

My script is correct (no spaces between class and id), I erred when I wrote here. In addition the script does not work is this: $ (".jPag-first"). click (function () { $('#magazine'). turn ('page', 1); });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.