How Do I load a jquery function dynamically?
I'm currently working on a Java web application, and have dynamically generated input boxes on the jsp page. I'm trying to use the setupElementMasks() function from http://www.xaprb.com/html-input-mas开发者_StackOverflow中文版k/html-form-input-mask.js to mask input. My input boxes are generated dynamically so would I have to use jquery's .load function to load the desired function?
I think you're looking for the .live()
function.
http://api.jquery.com/live/
Description: Attach a handler to the event for all elements which match the current selector, now and in the future.
<script src="/http://www.xaprb.com/html-input-mask/html-form-input-mask.js"></script>
<script>
$(function(){
doworkhere();
});
</script>
HTH
精彩评论