채택완료

버튼 다중 클릭시 중복 불가 이벤트 처리

2018-10-01 (월) 20:29:31 3,513

안녕하세요 ..

고수님들 부탁드립니다.. ㅠ////ㅠ

아무리 고민하고 찾아봐도 해답을 못찾겠습니다 ... 버튼이 여러개인데 버튼1을 클릭시 2를 클릭하면 클릭 불가 이벤트 처리를 하려고 하는데 아무리 찾아봐도 모르겠습니다.

Copy
$('.btndealdiscnt').bind('click',function(){
  if(($('.btnYakjung.active').attr('data-idx') == "0") && ($(this).attr('data-idx') == "1")){
    alert("클릭 불가.");
    return;
  }else if{
  (($('.btnEdiscnt.active').attr('data-idx') == "1") && ($(this).attr('data-idx') == "0")){
    alert("클릭 불가.");
    return;
  }
  $('.btndealdiscnt').removeClass('active');
  $('#deal').val($(this).attr('data-idx'));
  $(this).addClass('active');

어떤 부분을 어떻게 수정해야 할까요 ? ㅠㅠㅠㅠ

위처럼 수정했는데 아예 클릭 자체가 안됩니다 ㅠㅠ else if 말고 else 도 동일합니당

|

답변 2개

채택된 답변
+20 포인트
2018-10-01 (월) 22:25:40

// 비활성화

prop("disabled", true);

attr("disabled","disabled");

// 활성화

prop("disabled", false);

removeAttr("disabled");

참고하세요

2018-10-01 (월) 23:52:42

html, css, js는 html로 코딩된 부분을 보여 주셔야 답변하기 편합니다.

에디트 플러스 이런 걸로 연 코드 말고 브라우저에서 소스 보기로 해서 나오는 부분입니다.

답변을 작성하려면 로그인이 필요합니다.