Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MwyVWP
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test code</title>
</head>
<body>
<div id="hogehoge">クリックエリア</div>
<br>
<div id="hogehoge_s">クリックエリア2</div>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
</body>
</html>
function IDEACD(_target ,test){
this.target = _target;
this.comment = test;
}
IDEACD.prototype._globalClick = function(){
console.log(this.comment);
var hogehoge = this.comment;
$(this.target).click(function(){
alert(hogehoge);
});
};
var Click01 = new IDEACD('#hogehoge','test');
var Click02 = new IDEACD('#hogehoge_s','foo');
Click01._globalClick();
Click02._globalClick();
#hogehoge{
cursor: pointer;
}
#hogehoge_s{
cursor: pointer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.