好的我很困惑,希望有人可以告诉我我错过了什么。
我有一个用于收听点击事件和类名的类:.action-panel-button
我正在尝试为jQuery获取单个选择器行,但只有在使用两个不同的选项时它才有效:
我有一个链接,当它用于选择器时会触发:
// Only fires for content loaded initially with the page,
// not on dynamic content
$('.action-panel-button').on('click', function() {
console.log(a link fired);
});
以上内容不适用于动态添加的内容。所以我把它更新为:
// Only fires for content loaded dynamically via ajax,
// not on content originally loaded with the page
$(document).on('click', '.action-panel-button', function() {
console.log(a link fired);
});
我认为第二个应该适用于两者。我错过了什么?
答案 0 :(得分:0)
这适用于默认内容和动态添加的内容,这可能会对您有所帮助。
$ch=curl_init();
$url='https://auth.flurry.com/auth/v1/session';
curl_setopt($ch, CURLOPT_URL, $url);
$headers=array('Content-Type:application/vnd.api+json');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
$post='{"data":{"type":"session","id":"bc150468-5bd8-4914-b00a-0ee496a2aa98","attributes":{"scopes":"","email":"email","password":"password","remember":"false"}}}';
curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$data = curl_exec($ch) or exit(curl_error($ch));
print_r($data);
curl_setopt($ch, CURLOPT_URL, 'https://dev.flurry.com/entitiesSummaryJson.do?appSpotOrAppCircleData=0&intervalCut=customInterval2016_07_16-2016_07_16&entityType=adSpace&zoom=d&json=true&metrics=impressions,clicks,ctr,applicationAdConversions,videoCompletions,erpm,revenue,requests,fillrate,ds_fillrate');
$response=curl_exec($ch) or exit(curl_error($ch));
$( "body" ).delegate( "p", "click", function() {
$( this ).after( "<p>Another paragraph!</p>" );
});
p {
background: yellow;
font-weight: bold;
cursor: pointer;
padding: 5px;
}
p.over {
background: #ccc;
}
span {
color: red;
}