반응형
반응형
jQuery를 이용하여 상황별 체크박스를 제어해보자.기본적으로 대부분은 radio도 동일하게 사용된다. 상황1체크된 모든 엘리먼트(element)의 개수를 확인하기체크상태를 확인하는 선택자(selector)의 필터는 ":checked" 이다.$("선택자:checked") 가 기본값이고, filter를 이용해도 된다.$("선택자").filter(":checked"); $("#btnbyname").click(function(){ $("#dp_btnbyname").text($("input[type='checkbox'][name='chk[]']:checked").length); }); $("#btnbyclass").click(function(){ // 기본사용법 //$("#dp_btnbyclass").text(..
버그인지 아닌지는 모르겠지만 jquery ui 의 datepicker 사용시연도와 월의 셀렉트박스의 크기 때문에 모양이 틀어져 보일경우jquery-ui-min.css (또는 해당 버전css) 에서.ui-datepicker select.ui-datepicker-year { width: 49%;}위부분을 찾아서 width 를 적절히 조절해준다.또 글자 크기를 변경 하고자 할 경우.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none;}에서 font-size를 지정 해준다. 2014.08.05
스타일을 이용한 문장 줄이기 한줄인 경우 아래와 같이 적용 .classname{ overflow : hidden; white-space: nowrap; text-overflow:ellipsis; -o-text-overflow:ellipsis; -ms-text-overflow:ellipsis; -moz-text-overflow:ellipsis } 여러줄인 경우 또는 wrap 된 경우 위와 같이 해선 안된다. CSS를 이용한 방법이 있지만 모든 웹브라우저에는 적용이 안된다 .classSec{ overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; /* 라인수 */ -webkit-box-orient: vert..
text ... var data = $('li.someclass').metadata(); if ( data.some && data.some == 'data' ) alert('It Worked!'); @Reference http://phpschool.com/gnuboard4/bbs/board.php?bo_table=forum&wr_id=146638&page=3 http://stackoverflow.com/questions/4189036/custom-data-in-xhtml-1-0-strict
요소객체 DOM 속성을 반환,설정 elem.checkedtrue (Boolean) Will change with checkbox state$(elem).prop("checked")true (Boolean) Will change with checkbox stateelem.getAttribute("checked")"checked" (String) Initial state of the checkbox; does not change$(elem).attr("checked")(1.6)"checked" (String) Initial state of the checkbox; does not change$(elem).attr("checked")(1.6.1+)"checked" (String) Will change with..
다운로드 : // jQuery Right-Click Plugin // // Version 1.01 // // Cory S.N. LaViska // A Beautiful Site (http://abeautifulsite.net/) // 20 December 2008 // // Visit http://abeautifulsite.net/notebook/68 for more information // // Usage: // //// Capture right click //$("#selector").rightClick( function(e) { //// Do something //}); // //// Capture right mouse down //$("#selector").rightMouseDown( funct..
선택된 요소에 jQuery 메서드를 한꺼번에 연결해서 적용되게 한다. 체인 적용전 $("#id").val("Click me"); $("#id").addClass("cssclass"); $("#id").css({"width":"300px"}); $("#id").click(function(e){ alert('hello'); }) 체인 적용후 (들여쓰기와 줄바꿈을 이용할 수 있다.) $("#id").val("Click me").addClass("cssclass").css({"width":"300px"}) .click(function(e){ alert('hello'); })
jQuery(document).ready(function(){ $(document).mousemove(function(e){ arr_mousexy["x"] = e.pageX; arr_mousexy["y"] = e.pageY; }); });