I have a list of data that has a click-to-expand effect. Since this list of data is used
ajax
Loading, is
ajax
After loading the
click
Time does not work, I hope that the great God to help you see.
This is
html
The data structure and page layout in
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
js
The following are the expansion click
events and ajax
requests in
php
div
settings and data settings in the
$value) { $html .=''; $html .=''.$value['desc'].'
'; $html .='
时间:'.date('Y-m-d', $value['updateTime']).' | 来源:'.$value['author'].' 展开
'; $html .='';}$result['html'] = $html;exit(json_encode($result));
I php
have added the styles in the middle div
! But it just doesn't work.
Reply content:
I have a list of data that has a click-to-expand effect. Since this data list ajax
is loaded, that is ajax
, the time after loading click
does not work, I hope that the great God to help you see.
This is the html
data structure and page layout in
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
消费者的信息会逐渐增多,如果有一个厂家,用更好的原料和工艺,就会迅速占领市场
时间:2016-05-24 | 来源:本站 展开
js
The following are the expansion click
events and ajax
requests in
php
div
settings and data settings in the
$value) { $html .=''; $html .=''.$value['desc'].'
'; $html .='
时间:'.date('Y-m-d', $value['updateTime']).' | 来源:'.$value['author'].' 展开
'; $html .='';}$result['html'] = $html;exit(json_encode($result));
I php
have added the styles in the middle div
! But it just doesn't work.
Thank you for inviting me. I've had this similar problem before, and it's also the result of the ajax()
loaded data that invalidates the original effect. Here's how I handle it.
// 初始化数据的时候我也是这么写的$('.message-but').click(function(){ // code...});// ajax加载后click事件不执行,又改成这样$('.message-but').live("click",function(){ // code...});
After the online query to know that this live()
actually and bind()
almost the same use, are can give the future element binding corresponding trigger event, but there are still different. Both of you try and hope it helps you.
There's no live method after jquery1.9+.
We can write the previous version of jQuery1.9:
$("a").live("focus",function(){
jQuery1.9 since live was deleted, it should be written like this:
$(document).on("focus","a",function(){
I have a rough look at it, and if each of you list-data-detail
is dynamically loaded through Ajax, then the event you started writing directly click
doesn't work, and the DOM doesn't exist when you're bound to the event.
At this time, you need to use 事件委托
, in jQuery
, that is
$('.list-data').on('click', '.open-detail', function() { /// here goes the code});
That's all. With event delegates, the child element's event is bound to the parent element, and after the child element is clicked, the event bubbles to the parent element, which is responsible for capturing and then triggering the event by the parent element.
Dynamically loaded elements to perform a click can be like this
$(document).on('click','.message-but',function(){ // code...});