创建一个jQuery用户控件 [英] Create a jquery User Control

查看:75
本文介绍了创建一个jQuery用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个客户端的用户控件,
我有一个html页面,其中有我的控件(我想添加到该页面).
我的html文件中包含css和javascript函数.
通过单击按钮,我的控件应显示在页面上.
我使用了这种方法:

I want to create a user control that is client side,
I have a html page that my control (I want to be added to the page) is in it.
I have css and javascript functions in my html file.
By clicking the button my control should be appeared on the page.
I used this method:

div id="divMain">
        <label id="lblTitle">Add Here ...</label>
    </div>
    <div>
        <input type="button" id="btnAddControl" value="Add Control"/>
    </div> 





$("#btnAddControl").click(function () { $("#divMain").append($("<div></div>").load('HTMLPage.htm')) });



问题出在第二次点击.
第一个还可以,它显示了我控件的所有元素.
但第二次点击它就不知道javascript函数,而js函数不起作用

请帮帮我...
有什么解决办法吗?

谢谢
Bahar



The problem is in the second click.
first one is ok and it shows all the elements of my control.
but on second click it doesn''t know javascript functions and js functions doesn''t work

Please help me...
Is there any solution?

Thanks
Bahar

推荐答案

(" ).click(函数(){
("#btnAddControl").click(function () {


(" #divMain").append(
("#divMain").append(


( < div></div>").load( HTMLPage.htm'))});
("<div></div>").load('HTMLPage.htm')) });



问题出在第二次点击.
第一个还可以,它显示了我控件的所有元素.
但第二次点击它就不知道javascript函数,而js函数不起作用

请帮帮我...
有什么解决办法吗?

谢谢
Bahar



The problem is in the second click.
first one is ok and it shows all the elements of my control.
but on second click it doesn''t know javascript functions and js functions doesn''t work

Please help me...
Is there any solution?

Thanks
Bahar


这篇关于创建一个jQuery用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆