Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Online jQuery Editor

<!DOCTYPE html>
<html>
<head>
<title>Try jQuery Online</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
   $("em").addClass("selected");
   $("#myid").addClass("highlight");
});

</script>
<style>
.selected { 
    color:red; 
}
.highlight { 
    background:yellow; 
}
</style>
</head>
<body>
<em title="Bold and Brave">This is first paragraph.</em>
<p id="myid">This is second paragraph.</p>
</body>
</html>

asdaafaf

<html>
    
<head>
</head>    
    
<body>

<div id='tableauViz'  style="height:100%"> </div>

<script type="text/javascript" src="https://onlinehelp.tableau.com/samples/en-us/js_api/jquery-1.9.1.js"></script>
<script type="text/javascript" src="https://onlinehelp.tableau.com/samples/en-us/js_api/jquery-ui-1.10.0.custom.js"></script>
<script type="text/javascript" src="https://public.tableau.com/javascripts/api/tableau-2.0.0.min.js"></script>
<script>

function isMessage(txt, msg) {

  return txt.substring(0, msg.length) === msg;

}

function initializeViz() {
    
    var vizLoaded = false;
    // these are just constants for the messages returned.
    var LOADED_INDICATOR = 'tableau.loadIndicatorsLoaded';  
    var COMPLETE_INDICATOR = 'tableau.completed';
    
    
  var placeholderDiv = document.getElementById("tableauViz");
  var url = "https://public.tableau.com/views/WorldIndicators/GDPpercapita";
  var options = {
    width: placeholderDiv.offsetWidth,
    height: placeholderDiv.offsetHeight,
    hideTabs: true,
    hideToolbar: true,
    onFirstInteractive: function (e) {
      workbook = viz.getWorkbook();
      activeSheet = workbook.getActiveSheet();
    }
  };
  
  
  

    
    viz = new tableau.Viz(placeholderDiv, url, options);



    // SEE THIS
    try{
          viz.addEventListener('test123', function(msg) {       //test123 is a fake event
            alert(msg)
          });
    }
    catch(e){
        alert('An error has occurred: '+e.message + e.tableauSoftwareErrorCode)
    }


}

  

initializeViz();
</script>

</body>
</html>

jQuery - Miscellaneous Methods

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  personObj = new Object();
  personObj.firstname = "John";
  personObj.lastname = "Doe";
  personObj.age = 50;
  personObj.eyecolor = "blue";
  
  $("#btndataAtt").click(function(){
    $("#div21").data("greeting", "Hello World");
  });
  $("#btndataGet").click(function(){
    $("#div21").text($("#div21").data("greeting"));
  });
  $("#btnremoveData").click(function(){
    $("#div21").removeData("greeting");
    $("#div21").text($("#div21").data("greeting"));
  });
  
  $("#btndataAtt2").click(function(){
    $("#div22").data(personObj);
  });
  $("#btndataGet2").click(function(){
    $("#div22").text($("#div22").data("firstname"));
  });
  
  $("#btnParam").click(function(){
    $("#div1").text($.param(personObj));
  });
});
</script>
</head>
<body>

<hr>
<a href="https://www.w3schools.com/jquery/jquery_ref_misc.asp"><h2>jQuery Misc Methods</h2></a>
<table class="w3-table-all notranslate" border="1">
<tr>
<th style="width:20%">Method</th>
<th>Description</th>
</tr>
<tr>
<td><a>data()</a></td>
<td>Attaches data to, or gets data from, selected elements</td>
</tr>
<tr>
<td><a href="misc_each.asp">each()</a></td>
<td>Execute a function for each matched element</td>
</tr>
<tr>
<td><a href="misc_get.asp">get()</a></td>
<td>Get the DOM elements matched by the selector</td>
</tr>
<tr>
<td><a href="misc_index.asp">index()</a></td>
<td>Search for a given element from among the matched elements</td>
</tr>
<tr>
<td><a href="misc_noconflict.asp">$.noConflict()</a></td>
<td>Release jQuery's control of the $ variable</td>
</tr>
<tr>
<td><a>$.param()</a></td>
<td>Create a serialized representation of an array or object (can be used as URL query string 
for AJAX requests)</td>
</tr>
<tr>
<td><a>removeData()</a></td>
<td>Removes a previously-stored piece of data</td>
</tr>
  <tr>
<td><a>size()</a></td>
<td><span class="deprecated">Removed in version 3.0.</span> Use the <a href="prop_length.asp">length</a> 
property instead</td>
  </tr>
  <tr>
<td><a href="misc_toarray.asp">toArray()</a></td>
<td>Retrieve all the DOM elements contained in the jQuery set, as an array</td>
  </tr>
</table>

<h3>$.param() Method</h3>
<table border="1">
  <tr>
    <td>
      <button id="btnParam">$.param()</button>
    </td>
    <td width="100px">
    <div id="div1"></div>    
    </td>
  </tr>
</table>

<h3>jQuery Misc data() Method</h3>
<table border="1">
  <tr>
    <td>
      <button id="btndataAtt">Attach data</button>
      <br>
      <button id="btndataGet">Get data</button>
      <br>
      <button id="btnremoveData">Remove data</button>
    </td>
    <td width="100px">
    <div id="div21"></div>    
    </td>
  </tr>
  <tr>
    <td>
      <button id="btndataAtt2">Attach data to div element(Oject)</button>
      <br>
      <button id="btndataGet2">Get data attached to div element(Oject)</button>      
    </td>
    <td width="100px">
    <div id="div22"></div>    
    </td>
  </tr>  
</table>


</body>
</html>

Online jQuery Editor

<html>
   <head>
      <title>The jQuery Example</title>
      <base href="https://www.tutorialspoint.com" />
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $("#myimg").attr("src", "/jquery/images/jquery.jpg");
         });
      </script>
   </head>
	
   <body>
      <div>
         <img id = "myimg" src = "/images/jquery.jpg" alt = "Sample image" />
      </div>
   </body>
</html>

jQuery - Properties

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("#href2").on("click",function(){ 
    var version = $().jquery; 
    alert("You are running jQuery version: " + version); 
  });
  $("#href5").on("click",function(){ 
    $("#spanajax").text(jQuery.support.ajax);
    $("#spancheckClone").text(jQuery.support.checkClone); 
    $("#spannoCloneChecked").text(jQuery.support.noCloneChecked); 
    $("#spanclearCloneStyle").text(jQuery.support.clearCloneStyle);
    $("#spanboxSizingReliable").text(jQuery.support.boxSizingReliable); 
    $("#spanpixelBoxStyles").text(jQuery.support.pixelBoxStyles); 
    $("#spanpixelPosition").text(jQuery.support.pixelPosition); 
    $("#spanreliableMarginLeft").text(jQuery.support.reliableMarginLeft); 
    $("#spanscrollboxSize").text(jQuery.support.scrollboxSize); 
    $("#spancheckOn").text(jQuery.support.checkOn); 
    $("#spanoptSelected").text(jQuery.support.optSelected); 
    $("#spanradioValue").text(jQuery.support.radioValue); 
    $("#spanfocusin").text(jQuery.support.focusin); 
    $("#spancors").text(jQuery.support.cors);
    $("#spancreateHTMLDocument").text(jQuery.support.createHTMLDocument); 
  });  
  $("#href6").on("click",function(){ 
    alert("table의 tr 수 : " + $("tr").length);
  });  
}); 
</script>
</head>
<body>
<h2>jQuery Properties</h2>
<table border=1>
<tr>
<th style="width:20%">Property</th>
<th>Description</th>
</tr>
<tr>
<td><a>context</a></td>
<td><span>Removed in version 3.0.</span> Contains the 
original context passed to jQuery()</td>
</tr>
<tr>
<td><a id="href2"  href="#">jquery</a></td>
<td>Contains the jQuery version number</td>
</tr>
<tr>
<td>jQuery.fx.interval</td>
<td>Change the animation firing rate in milliseconds</td>
</tr>
<tr>
<td>jQuery.fx.off</td>
<td>Globally disable/enable all animations</td>
</tr>
<tr>
<td><a id="href5" href="#">jQuery.support</a></td>
<td>A collection of properties representing different browser features or bugs 
(Intended for jQuery's internal use)</td>
</tr>
<tr>
<td><a id="href6" href="#">length</a></td>
<td>Contains the number of elements in the jQuery object</td>
</tr>
</table>

<hr>
<h3>jQuery.support Property</h3>
<table border=1>
  <tr>
    <th style="width:20%">Property</th>
    <th style="width:20%">Value</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>jQuery.support.ajax</td>
    <td><label id="spanajax"></label></td>
    <td>This browser can create XMLHttpRequest object</td>
  </tr>
  <tr>
    <td>jQuery.support.checkClone</td>
    <td><label id="spancheckClone"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.noCloneChecked</td>
    <td><label id="spannoCloneChecked"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.clearCloneStyle</td>
    <td><label id="spanclearCloneStyle"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.boxSizingReliable</td>
    <td><label id="spanboxSizingReliable"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.pixelBoxStyles</td>
    <td><label id="spanpixelBoxStyles"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.pixelPosition</td>
    <td><label id="spanpixelPosition"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.reliableMarginLeft</td>
    <td><label id="spanreliableMarginLeft"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.scrollboxSize</td>
    <td><label id="spanscrollboxSize"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.checkOn</td>
    <td><label id="spancheckOn"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.optSelected</td>
    <td><label id="spanoptSelected"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.radioValue</td>
    <td><label id="spanradioValue"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.focusin</td>
    <td><label id="spanfocusin"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.cors</td>
    <td><label id="spancors"></label></td>
    <td></td>
  </tr>  
  <tr>
    <td>jQuery.support.createHTMLDocument</td>
    <td><label id="spancreateHTMLDocument"></label></td>
    <td></td>
  </tr>  
</table>

</body>
</html>

jQuery - Siblings

<!DOCTYPE html>
<html>
<head>
<style>
.siblings * { 
  display: block;
  border: 2px solid lightgrey;
  color: lightgrey;
  padding: 5px;
  margin: 15px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("#button1").click(function(){
    $("h2").siblings("").css({"color": "red", "border": "2px solid red"});
  }); 
  $("#button2").click(function(){
    $("h2").siblings("p").css({"color": "red", "border": "2px solid red"});
  }); 
  $("#button3").click(function(){
    $("h2").next().css({"color": "red", "border": "2px solid red"});
  }); 
  $("#button4").click(function(){
    $("h2").nextAll().css({"color": "red", "border": "2px solid red"});
  }); 
  $("#button5").click(function(){
    $("h2").nextUntil("h6").css({"color": "red", "border": "2px solid red"});
  });   
});
</script>
</head>
<body>
<button id="button1">siblins</button>
<button id="button2">siblins(p)</button>
<button id="button3">siblins(next)</button>
<button id="button4">siblins(nextAll)</button>
<button id="button5">siblins(nextUntil)</button>
<div class="siblings">
<div>div (parent)
  <p>p</p>
  <span>span</span>
  <h2>h2</h2>
  <h3>h3</h3>
  <h4>h4</h4>
  <h5>h5</h5>
  <h6>h6</h6>  
  <p>p</p>
</div>
</div>
</body>
</html>

jQuery - Effects - Animation

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script> 
$(document).ready(function(){
  $("#btn11").click(function(){
    $("#div11").animate({
      left: '250px',
      opacity: '0.5',
      height: '150px',
      width: '150px'
    });
  });
  $("#btn12").click(function(){
    $("#div11").animate({
      left: '250px',
      height: '+=150px',
      width: '+=150px'
    });
  }); 
  $("#btn13").click(function(){
    $("#div11").animate({
      height: 'toggle'  //"show", "hide", or "toggle":
    });
  });  
  
  
  //2.
  $("#btn21").click(function(){
    var div = $("#div21");
    div.animate({height: '300px', opacity: '0.4'}, "slow");
    div.animate({width: '300px', opacity: '0.8'}, "slow");
    div.animate({height: '100px', opacity: '0.4'}, "slow");
    div.animate({width: '100px', opacity: '0.8'}, "slow");
  });
  $("#btn22").click(function(){
    var div = $("#div22");
    div.animate({left: '100px'}, "slow");
    div.animate({height: '100px'}, "slow");
    div.animate({width: '200px'}, "slow");
    div.animate({fontSize: '3em'}, "slow");
  });  
});
</script> 
<style> 
#div11,#div21 {
    background:#98bf21;
    height:100px;
    width:100px;
    //position:absolute;
}
</style>
</head>
<body>

<div>
    1. 기본 예제<br>
<button id="btn11">1.Start Animation</button>
<button id="btn12">2.Start Animation</button>
<button id="btn13">3.toggle Animation</button>

<p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p>

<div id="div11"></div>
</div>
<br>

<div>
<p>2. Example
<br>Queue functionality for animations</p>
<button id="btn21">1.Example</button><br>
<div id="div21"></div>
</div>

<button id="btn22">2.Example</button><br>
<div id="div22" style="background:#98bf21;height:100px;width:100px;position:absolute;">HELLO</div>
</div>
</body>
</html>

jQuery - Effects - Fade

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("#btnFadeIn").click(function(){
    $("#divFadeIn1").fadeIn();
    $("#divFadeIn2").fadeIn("slow");
    $("#divFadeIn3").fadeIn(3000);
  });
  $("#btnFadeOut").click(function(){
    $("#divFadeIn1").fadeOut();
    $("#divFadeIn2").fadeOut("slow");
    $("#divFadeIn3").fadeOut(3000);
  });
  $("#btnFadeToggle").click(function(){
    $("#divFadeIn1").fadeToggle();
    $("#divFadeIn2").fadeToggle("slow");
    $("#divFadeIn3").fadeToggle(3000);
  });  
  $("#btnFadeTo").click(function(){
    $("#divFadeIn1").fadeTo("slow", 0.15);
    $("#divFadeIn2").fadeTo("slow", 0.4);
    $("#divFadeIn3").fadeTo("slow", 0.7);
  });  
});
</script>
</head>
<body>
<div id="divFadeIn">
<p>Demonstrate fadeIn with different parameters.</p>

<button id="btnFadeIn">Click to fade in boxes</button>
<button id="btnFadeOut">Click to fade out boxes</button>
<button id="btnFadeToggle">Click to fade toggle boxes</button>
<button id="btnFadeTo">Click to fade to boxes</button>
<br><br>

<div id="divFadeIn1" style="width:80px;height:80px;display:none;background-color:red;"></div><br>
<div id="divFadeIn2" style="width:80px;height:80px;display:none;background-color:green;"></div><br>
<div id="divFadeIn3" style="width:80px;height:80px;display:none;background-color:blue;"></div>

</div>
</body>
</html>

jQuery - Events Handling

<!DOCTYPE html>
<html>
   <head>
      <title>The jQuery Example</title>
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $('div').bind('click', function( event ){
                var content 
                content = 'Event type : ' + event.type;
                content = content + "<br>" + 'pageX : ' + event.pageX
                content = content + "<br>" + 'pageY : ' + event.pageY
                content = content + "<br>" + 'Target.innerHTML : ' + event.target.innerHTML;
                content = content + "<br>" + 'Target.nodeName  : ' + event.target.nodeName ;
                content = content + "<br>" + 'currentTarget.nodeName : ' + event.currentTarget.nodeName;
                content = content + "<br>" + 'delegateTarget.nodeName : ' + event.delegateTarget.nodeName;
                content = content + "<br>" + 'isDefaultPrevented :' + event.isDefaultPrevented();
                content = content + "<br>" + 'namespace : ' + event.namespace
                content = content + "<br>" + 'result : ' + event.result
                content = content + "<br>" + 'timeStamp : ' + event.timeStamp;
                content = content + "<br>" + 'which : ' + event.which;
                //$('#span-1').text(content);
                $('#span-1').html(content);
            });
         });
      </script>
		
      <style>
         .div{ margin:10px;padding:12px; border:2px solid #666; width:60px;}
      </style>
   </head>
	
   <body>
        <p>* Click on any square below to see the result</p>
	    <span id="span-1"></span>	
        <div class = "div" style = "background-color:blue;">ONE</div>
        <div class = "div" style = "background-color:green;">TWO</div>
        <div class = "div" style = "background-color:red;">THREE</div>
   </body>
</html>

Online jQuery Editor

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>GitHub Repos</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://code.jquery.com/jquery-3.2.1.js"></script>
</head>
<body>
Username:
<input type="text" id="username"/><br><br>
Reponame: <input type="text" id="reponame"/><br><br>

<button onclick="loadRepos()">Load Repos</button>
<div id="repos">
    
        
   
</div>
<script>
   function loadRepos() {
       
        var reponame = document.getElementById("reponame").value;
        var url="https://api.github.com/repos/sunandarath/"+reponame;
     
alert(url);
$.ajax({
    url,
    type: 'DELETE',
    beforeSend: function(xhr) { 
        xhr.setRequestHeader("Authorization", "token f2d8f731ee993982309d593841787b11541ce7e1"); 
    }
}).done(function(response) {
   alert("Repository "+reponame+" is deleted");
});
        
    }
</script>
 
</body>
</html>

Previous 1 ... 5 6 7 8 9 10 11 ... 120 Next
Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.