简体   繁体   English

jQuery和DOM元素单击功能

[英]jquery and DOM element click function

I have a problem with a DOM element that is not recognized by jQuery. 我对jQuery无法识别的DOM元素有疑问。

The site is: 该站点是:

http://www.italartsofas.it/collection2012/ 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”和“ ultima”类的div上工作:

$ (". 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. 实际上,单击“ Prima pagina”和“ Ultima pagina”脚本即可。

The moment I try to run it on the link "First" with class "jPag-first" pages do not change. 当我尝试在具有类“ jPag-first”的页面的“ First”链接上运行它时,不会更改。

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? 也许是因为div#demo1的内容是使用jQuery创建的,并且在HTML中尚不存在?

You need to remove space here: 您需要在此处删除空间:

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

Should be: 应该:

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

There should be no space between class/id identifiers. 类/ id标识符之间不应有空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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