我想将Jquery对象传递给函数,但它不适用于IMG标记.
我在下面做了一个例子.当我点击文本时它可以工作,但是当我点击图像时它不起作用.
$(document).on('click','.playvid',function (event) {
event.stopPropagation();
popup($(event.target));
});
function popup(data)
{
data.html("success");
}Run Code Online (Sandbox Code Playgroud)
.playvid
{
cursor:pointer;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div data-id="3ZdHRvPNyCI" class=" playvid" ><img src="https://cdn4.iconfinder.com/data/icons/iconset-addictive-flavour/png/button_green_play.png">WATCH DEMO</div>Run Code Online (Sandbox Code Playgroud)
我遇到方法有问题.因此,在一个方法中,我向用户询问名字,我想将该String存储在另一个方法中,然后让我的main方法调用存储String的方法.但是我在存储该字符串时遇到了麻烦.我正在使用此代码:
static void GetStudentInformation()
{
Console.WriteLine("Enter the student's first name: ");
string firstName = Console.ReadLine();
}
static void PrintStudentDetails(string first)
{
Console.WriteLine("{0}", first);
}
public static void Main (string[] args){
GetStudentInformation();
}
Run Code Online (Sandbox Code Playgroud)
因此,一旦输入名称,它应该存储在详细信息方法中,然后在main方法中调用.谢谢你提前帮助我.