"columns" : [
	    	{"data" : "no","defaultContent":""},				
	    	{"data" : "name","defaultContent":""},
	    	{"data" : "user_id","defaultcontent":""},				
	    	{"data" : "",
	    		render: function(data,type,row){
	    			return "<button id='btn_info' type='button' class='btn' onClick='openInfo("+row.user_id+")'>상세정보</button>";
	    		}
	    	}
	],

 

function openInfo(user_id) {

	// Table 에서 받은 user_id 출력
	console.log(user_id);
    
}
Posted by 비니미니파
JavaScript&Platform/jQuery2020. 9. 10. 10:47

<select id="choice">
   <option value="1">하나</option>
   <option value="2">둘</option>
   <option value="3">셋</option>
</select>

<script>

    $("#choice").val("2").prop("selected",true);

</script>

 

* jquery 환경에서 실행 됩니다.

+ 추가 +

change 이벤트가 발생하지 않을 때

    $("#choice").val("1").prop("selected",true).change();

 

Posted by 비니미니파
JavaScript&Platform/jQuery2014. 12. 11. 09:50

구글링으로 찾은 예제를 조금 수정하였다.

다음에 재활용하기 위해 function 으로 만들어 보았다.

// 숫자 자동증가
// ex)  autoIncrementVal( obj, val, durationVal );
//      autoIncrementVal( "#testVal", 95, 2500 );
var autoIncrementVal = function(obj, val, durationVal)
{
 $({someValue: 0}).animate({someValue: val}, {
     duration: durationVal,
     easing:'swing', // can be anything
     step: function() { // called on every step
      // Update the element's text with rounded-up value:
      $(obj).text(Math.ceil(this.someValue));
     }         
    });
}

Posted by 비니미니파
JavaScript&Platform/jQuery2013. 1. 18. 13:35

대충 만듬....

<!DOCTYPE>
<HTML>
 <HEAD>
  <TITLE> Div Resize </TITLE>

<script type="text/javascript" src="./js/jquery-1.9.0.min.js"></script>


<style>
div { border : 1px solid #ccc }

#row1 div {
 position: absolute;
}
#row2 div {
 position: absolute;
}

</style>


<script>

$(window).load(function(){ 
 setSize();

});


$(window).resize(function(){ 
 setSize();
});

function setSize() {
 var cellLeft = null;
 var rowHeight = null;
 var rowTop = 0;
    var rowWidth = $('#row1').innerWidth();

 var rowNum = $("#wrapper").children().length;
 var divNum = $("#row1").children().length;

 for ( r = 1; r <= rowNum ; r++ )
 {

  cellLeft = 0;

  $('#row'+r+' .quarter').css({'width':rowWidth/4} ); 
  $('#row'+r+' .half').css({'width':rowWidth/2} );

  for ( i = 1; i <= divNum ; i++ )
  {
   cellWidth = $('#row'+r+' .cell' + i).width();

   $('#row'+r+' .cell'+i).css({left:cellLeft, top: rowTop});

   cellLeft += cellWidth;
  }

  rowHeight = $('#row'+r+' .cell1').height();

  rowTop += rowHeight;

 }
}

</script>

 </HEAD>

 <BODY id ="body">
<div id="wrapper">
 <div id="row1">
  <div class="cell1 quarter">
   <img class="quarter" src="11.jpg">
  </div>
  <div class="cell2 quarter">
   <img class="quarter" src="22.jpg">
  </div>
  <div class="cell3 half">
   <img class="half" src="33.jpg">
  </div>
 </div>
 <div id="row2">
  <div class="cell1 quarter">
   <img class="quarter" src="11.jpg">
  </div>
  <div class="cell2 half">
   <img class="half" src="33.jpg">
  </div>
  <div class="cell3 quarter">
   <img class="quarter" src="22.jpg">
  </div>
 </div>

</div>
 
 
 </BODY>
</HTML>

 

Posted by 비니미니파