jquery call user function from plugin -


i'm trying create simple jquery plugin project

i want call user function plugin, how

my code when user passes below options want call ss function

{id:"today",value:"today",func: "ss()"}, 

here plugin code

$('#drop1').append("<li id='"+options.items[i].id+"' onclick='"+options.items[i].func+"'>"+options.items[i].value+"</li>"); 

this not calling user function, how this?

demo

use event delegation when add dynamic dom element . here made simple sample related questions

var options={id:"today",value:"today",func: ss}       $('#drop1').append("<li id='"+options.id+"'>"+options.value+"</li>");      $('#drop1').on("click","#"+options.id,options.func); // here can bind event   function ss(){     alert(1);     } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -