<input type="button" class="add_add" id='count' value="추가" onclick="insert_pin()">
<script>
var count = 0;
var inter;
function add(){
count += 1;
$('#count').html(count)
}
$(document).ready(function(){
$('.add_add').on('mousedown',function(){
inter = setInterval(add , 70)
})
$('#add_add').on('mouseup',function(){
clearInterval(inter)
})
})
</script>
게시물을 작성 후 버튼을 클릭하면 숫자가 증가되고 제목으로 나오게 하려고 싶습니다 ㅠㅠ
초보라 너무 어렵네요..
답변 4개 / 댓글 2개
증가된 숫자를 표시해 주는 부분이 필요합니다.
<div id=subject></div>
자바스크립트
$("#subject").html(count);
답변에 대한 댓글 1개
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script>
var count = 0;
var inter;
function add(){
count += 1;
$('#count').html(count)
$("#wr_subject").html(count);
}
$(document).ready(function(){
$('.add_add').on('mousedown',function(){
inter = setInterval(add , 70)
})
$('.add_add').on('mouseup',function(){
clearInterval(inter)
})
})
</script>
<div id=wr_subject>0</div>
<div id=count>0</div>
<input type="button" class="add_add" id='count' value="추가" >
문제으 원인인 #add_add였네요 .add_add로 수정해주세요
jquery 선언도 있어야하구요
답변에 대한 댓글 1개
작성시 게시물이라고 제목에 표시됩니다.
<script>
var count = 0;
var inter;
function add(){
count += 1;
$('#count').html(count)
$("#wr_subject").html(count);
}
$(document).ready(function(){
$('.add_add').on('mousedown',function(){
inter = setInterval(add , 70)
})
$('#add_add').on('mouseup',function(){
clearInterval(inter)
})
})
</script>
이외 스크립트는 없습니다 ㅠ
#wr_subject 가 어디에 있나요? 풀 코드를 주시겠어요
답변을 작성하려면 로그인이 필요합니다.
var count = 0;
var inter;
function add(){
count += 1;
$('#count').html(count)
$("#wr_subject").html(count);
}
$(document).ready(function(){
$('.add_add').on('mousedown',function(){
inter = setInterval(add , 70)
})
$('#add_add').on('mouseup',function(){
clearInterval(inter)
})
})
</script>
이런식으로 #wr_subject 으로 출력되게 하였는데, 제목에 나오질 않습니다 ㅠㅠ