JQUERY的新手 [英] New to JQUERY

查看:74
本文介绍了JQUERY的新手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个将参数作为控件名称的函数.

在此函数中,我想使用函数中传递的参数来获取该控件的客户端ID.例子

Hi I am trying to make a function that takes an argument as a control name.

In this function I would like to get the client id for that control using the argument passed in the function. Example

function GetControl(str)
{
$(''<%=str.ClientId%>'')  // Something like that.

}



请帮忙.



Please help.

推荐答案

(''<%= str.ClientId%>''))//类似的东西. }
(''<%=str.ClientId%>'') // Something like that. }



请帮忙.



Please help.


试图创建一个将参数作为控件名称的函数
正确地说但执行错误.

无论哪种方式,都直接将''<%=str.ClientId%>''传递给GetControl函数.在其中找到基于它的控件.




将函数名称更改为GetControlID(str),然后尝试立即执行操作.但是为此,您需要将整个控制对象传递给它.就像,一个控件使用''this''
调用自身
我将继续使用上一个,其中获取控件ID作为参数,然后找到该控件并进行一些更改.
trying to make a function that takes an argument as a control name
Rightly said but wrong implementation.

Either pass, ''<%=str.ClientId%>'' directly to GetControl function. In it, find the control based on it.


OR

Change the function name to GetControlID(str) and then try to do what you are doing right now. But for this, you need to pass entire control object to it. Like, a control calling itself using ''this''

I would go for previous one where one gets the control ID as a parameter then just find the control and do some changes.


再次解释一下!发布更多代码!我无法理解您想要什么以及为什么需要在javascript函数中传递控件名称:thumbsdown:
explain again! post some more code! I couldn''t understand what you want and why do you need to pass the control name in a javascript function :thumbsdown:


这篇关于JQUERY的新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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