본문 바로가기

ASP.NET MVC

Jquery click , hover 이벤트 추가

var Row = $("<tr lang='kr' vesselid='" + this.VesselID + "' >" +

"<td>" + this.VesselID + "</td>" +

"<td>" + this.VesselName + "</td>" +

"<td>" + this.VesselType + "</td>" +

"<td>" + this.VesselGroup + "</td>" +

"<td>" + this.Displacement + "</td>" +

"<td>" + this.Size + "</td>" +

"<td>" + this.Speed + "</td></tr>");

   

var newTd = $("<td></td>");

var newInput = $("<input type='button' name='userbtn" + this.VesselID + "' class='buttons' id='" + this.VesselID + "' value='사용자정보'/>")

.click(function() {

alert($(this).attr('id'));

location.replace("users/userinfo/" + $(this).attr('id'));

});

   

newTd.append(newInput);

Row.append(newTd);

   

   

Row.hover(function(event) {

$(event.target.parentNode).removeClass("leave");

$(event.target.parentNode).addClass("hover");

}, function(event) {

$(event.target.parentNode).removeClass('hover');

$(event.target.parentNode).addClass("leave");

}).click(function(event) {

$(event.target.parentNode).removeClass('rowClick');

$(event.target.parentNode).addClass("rowClick");

SelectDeatil(event)

});