我有这个代码
<html>
<head>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
<script type = "text/javascript">
function MyFunc(obj,method){
// obj.hide("slow"); // This part is working fine i.e. it is hiding the paragraph
obj + "." + method + "(\"slow\")"; // This is not working
$(function(){
$("#pid1").click(function(){
MyFunc($("#pid1"),"hide");
});
});
</script
</head>
<body>
<p id = "pid1">Test Paragraph</p>
</body>
</html>
即我想将参数传递给jquery hide 函数并形成正确的字符串来调用效果,但它不像上面的代码那样工作。我错过了什么吗?