jQuery can't bind event to AJAX loaded element using .on()

<>

This question already has an answer here:

Answers


In this case you need to use on in a similar way to delegate, the syntax you are using is the replacement for bind.

$("#step_2").on("change", "#subcategory_id", function(){
    alert( 'Success!' );
});

The first selector has to be an element that won't be replaced. This way, when the event bubbles up to this point it is caught. You then specify the actual element that will trigger the event as the 2nd parameter of .on.


Need Your Help

Access Not Configured. Please use Google Developers Console to activate the API for your project

youtube-api google-api

I am getting the same error thats solution is suggested in below answer. But not able to find the "Referers" option under my project.

Make available as download with JavaScript

javascript download kml

I create a file in JavaScript. Now I want to be able to make it available to the user as a download is this possible?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.