$(document).on("click","button",function() {
......
});
this worked in Adobe launch for button tagging.
$("button").onclick = function() {
......
};
This function works in the developer console and not in Adobe Launch. Does anyone have any idea why this does not work in Adobe launch?
Solved! Go to Solution.
Views
Replies
Total Likes
It looks like you may be relying on jquery (based on usage of ($). I'd check your source HTML and see if jQuery is being loaded BEFORE or AFTER Adobe launch is loaded on the page. If jQuery is loaded AFTER, you'd see the error from launch, but by the time you check the developer console - jQuery is loaded.
It looks like you may be relying on jquery (based on usage of ($). I'd check your source HTML and see if jQuery is being loaded BEFORE or AFTER Adobe launch is loaded on the page. If jQuery is loaded AFTER, you'd see the error from launch, but by the time you check the developer console - jQuery is loaded.
Thank you
Views
Replies
Total Likes
statement: $("button").onclick = function() {
......
};
Here statement is, not function decalring method, because onclick is older Javascipt method and $('button') is Jquery. So you are overrighting function declaring method. So Dom not excuding your script.
Instead of you can define the function on below full javascript method or full jquery method.
Here, Javascipt method.
<!DOCTYPE html>
<html>
<body>
<p id="button">Click me.</p>
<script>
document.getElementById("button").onclick = function() {myFunction()};
function myFunction() {
document.getElementById("button").innerHTML = "YOU CLICKED ME!";
}
</script>
</body>
</html>
Here, Jquery method. I hope you already working script with 2nd method.
Method 1 (old):
$('button').click(function(){
//do something
});
Medthod 2 (new):
$(document).on("click", "button", function(){
//do something
});