본문 바로가기

jQuery

(18)
[jquery][twbsPagination] 페이징 기본형 var page_count = Math.ceil({{총레코드수}} / {{페이지 오프셋}}); var page_data = $('#pagination').data(); if( typeof(page_data.twbsPagination) != 'undefined' ){ if( page_data.twbsPagination.options.totalPages != page_count ){ $('#pagination').twbsPagination('destroy'); //데이터가 갱신되면 페이징 갱신 } } $('#pagination').twbsPagination({ totalPages: page_count, //전체 페이지 수 visiblePages: page_count > 5 ? 5 : page_count, /..
[jquery] how to get custom attribute value HTML 100000 ~ 200000 200000 ~ 300000 300000 ~ 400000 400000 ~ 500000 500000 ~ 600000 js - jquery $('ul li').on('click', function(){ var rangeMinPrice = $(this).attr('rangeMinPrice'); var rangeMaxPrice = $(this).attr('rangeMaxPrice'); alert('rangeMinPrice : ' + rangeMinPrice + ' | rangeMaxPrice : ' + rangeMaxPrice); }); jsfiddle : https://jsfiddle.net/h5Lbb8wv/
[javascript] guid 만들기 html 생성 css #guid { width:500px; } javascript var _guid = {}; _guid.get = function() { return _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4(); } _guid.s4 = function() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } $('#btn_create').on('click', function(){ $('#guid').val(_guid.get()); }); demo : jsfiddle link
[jquery mobile] swipe event swipe left / right 는 기본적으로 이벤트 핸들러를 제공하는데 up/down 은 api doc 에 없어서 구현 된 예제를 찾아봤습니다. jquery Mobile https://api.jquerymobile.com/swipe/ jsfiddle https://goo.gl/Nwvhu1 touch swipe - 페이지 하단에 example 들이 있습니다. http://labs.rampinteractive.co.uk/touchSwipe/demos/Page_scrolling.html
[jQuery] to find checkbox and change attribute 1234567891011$(".Chk_Choice").click(function () { var parentChildren = $(this).parent().parent().parent().children(); var parentAllChecked = false; var isChecked = $(this).is(":checked"); var checkboxId = $(this).attr("id"); $.each(parentChildren.find("input[type=checkbox]"), function (index, item) { if (checkboxId != $(item).attr("id")) { $(item).attr("disabled", isChecked); } }); });Colored by..
[jquery][plugin] input mask jquery에는 무수히 많은 플러그인들이 있는데요. 웹개발에서 가장 많이 쓰이는 입력 양식이라면 금액 입력일 거 같습니다. 자동으로 3자리마다 "," 찍어주는 마스크 플러그인 중 유연하고 다양한 입력 mask 를 제공하는 플러그인을 찾아봤습니다. home page https://igorescobar.github.io/jQuery-Mask-Plugin/ //간단 예제 //금리 입력 $(".rate").mask('00.00', { reverse: true }); //금액 입력 $("input.inputGroup").mask('000,000,000,000,000', { reverse: true }); 웹소스에는 CDN 으로 간편하게 추가 할 수 있습니다. cdn url : https://cdnjs.cloudf..
[javascript] substring 문자열 자르기 HTML javascript var addressCode = '1174010300'; var result1 = addressCode.substring(0,2); var result2 = addressCode.substring(2,5); var result3 = addressCode.substring(5,8); document.getElementById("result").innerHTML = result1 + '|' + result2 + '|' + result3; demo link https://jsfiddle.net/yagdmirage/pk3zyduf/2/
[jquery][iCheck] iCheck 사용법 ( radio button 이 여러개일때) iCheck home http://icheck.fronteed.com/ jquery plugin iCheck https://plugins.jquery.com/icheck/ @{ string useYnCheck =to be priceInfo.useYn.Equals("Y") ? "checked"l : ""; string notUseYnCheck = priceInfo.useYn.Equals("N") ? "checked" : ""; I A-aa a } Use Y/N ㅌ: Y N View Y/N Y N OOO.js $(function () { $('input').iCheck({ radioClass: 'iradio_flat-green' }); $('input').on('ifChecked', function (eve..