HOME 개발팁 jQuery 자주쓰는 함수

프로그램 작업하다 좋은 팁, 정보, 테스트를 기록하는 곳입니다.


jQuery | jQuery 자주쓰는 함수

페이지 정보

작성자 굿스웹 작성일19-11-19 09:38 조회772회 댓글0건

본문

<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>



alert(data.result_msg); //메시지 창

window.open(hreft); //새창

document.location.href  //페이지 이동





$('input[type=text]').val("텍스트 값추가");

$('tr:odd').css('background', '#F9F9F9');

$('tr:event').css('background', '#9F9F9F');

$('tr:first').css('background', '#333333').css('color','#FFFFFF');    // 배경색 / 글자색

$('tr:eq(0)').css('background', '#000000').css('color', 'White');
$('선택').addClass('정의한 클래스이름');
$('선택'). removeClass ('삭제할 클래스이름');

arrt()
 => $('img').attr('src');
 => $(selector).attr(속성이름 , 속성값);
 => $(selector).attr(속성이름  , function( 속성각각의 index값  ,attr ){} );
 => $(selector).attr(object); 
 => $('<img />').attr('src', 'image.jpg').appendTo('body'); // body 에 img태스생성
 => $('<img />' , {src:''image.jpg, width:350, height:250}).appendTo('body');


$('h1').removeAttr('data-index') //제거

css()
$(selector).css(name , value); //추가


$('h1').html()
$(selector). text (value);
$('h1').first().remove();    // 첫번쩨 h1 삭제


trigger() //이벤트강제 발생
  $(selector).trigger(eventName)


//class 클릭
$(document).on("click", ".winhref", function () {

});


function popup(){



$(this). //현재위치


//통신 보내기
var param = {
"group"      : gro,
"type"      : gpm
}

$.ajax({
type    : "POST",
url    : "a.php",
data    : param,
dataType: "json",
success : function (data) {}
});


//버튼클릭 이동
$(document).on("click", ".href", function () {
  var hreft = $(this).attr("href");
  if(hreft) document.location.href = hreft;
});


//새창
$(document).on("click", ".winhref", function () {
  var hreft = $(this).attr("href");
  if(hreft) window.open(hreft);
});

img class="winhref m_logcode" href='이동할주소'

[숫자 콤마 찍기]
 return data.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');

[숫자 콤마 삭제]
 return str.replace(/[^\d]+/g, '');

[주소복사] https://www.goodsweb.kr/?u=D4108A5K
SNS 알리기
핀터레스트
텔레그램로
블로그로
카카오스토리
카톡 공유

관련 블로그
로딩중


2명  IP : 18.221.♡.143
001 34.♡.82.72 오류안내 페이지
(/bbs/content.php?co_id=)
002 216.♡.66.232 공공데이터포털 - 즐겨찾기
(/bbs/board.php?bo_table=bookmark&wr_id=15&sca=API)

접속자
  • 오늘 : 302
  • 어제 : 357
  • 최대 : 874
  • 전체 : 407,122

검색로봇(Robots) 최근 방문시간
  • GOOGLE : 5시간 전
  • NAVER : 16시간 전
  • BING : 19시간 전
  • DAUM : 1일 전

ETH : 0x8abf3B748ab78828AE07685e4fd53d1a606f18D3



페이스북 네이버 블로그 굿스웹 쇼핑몰 네이버 카페 굿스웹 트위터 굿스웹 티스토리 Google Play