how to bind a jquery event handler on a jquery post returned data -


i have problem first let me explain expect code do.

i have form selects depends on data selected select above it.

let's form creating menu_item

the first select should ask user of menu type. it's options - single article, article list, category view.

if user selects single article option, form should populate select field below should show articles database. likewise other menu type options.

at point managed write jquery code change method posts server , query database relevant option list data (let's articles) depending on menu type selection. , data returned expected.

the problem want still able bind change method returned data can still able populate link field right article selected above.

but whatever there no response whatsoever. $.change, $.click methods won't work on returned data above. when checked dom using firebug, saw div returned data inserted, blank though in browser data showing.

how bind jquery event listener returned data?

the html of returned data processed server, must use inline call listener function data html on server?

please thanks.

probably reason using .bind or simple .change method, elements not exist yet on page (appended after ajax call).

you should use .on method delegated events approach (or jquery 1.7 , older may use .live method )

$("#container_div").on("click", "#list_id li", function(event){     //list element clicked }); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -