User Tools

Site Tools


Sidebar



jquery

jQuery

jChartFX

jQuery alternatives

POST

$.post( "ajax/test.html", function( data ) {
  $( ".result" ).html( data );
});

GET

$.get("ajax/test.html", function(data) {
  $(".result").html(data);
  alert("Load was performed.");
});

Getting over jQuery

Hello World

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
 
<script>
$(document).ready(function() {
  alert("Hello World");
})
</script>

parsing html table (not finished)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
 
<script>
$(document).ready(function() {
 
  $('#result').load('index.php', function(data) {
 
    var rows = $("td[bgcolor=#00ffff]").parent();
    $(rows).each(function(index) {
      var cols = $(this).children("th,td");
      $(cols).each(function(index) {
      console.log($(this).html());//.replace(/n/g, '&nbsp;'));
      console.log($(this));
      });
      console.log("==========================");
    });
  });
 
});
</script>
 
<div id="result">Loading...</div>

headless browser

this & children

//$(e.currentTarget)  ===== $(this)
$(this).children(".description").text()
<script id="todo-list-item" type="text/x-jquery-tmpl">
  <li {{if done}}class="done"{{/if}}>
    <label>
      <input type="checkbox" id="todo-${id}" {{if done}}checked="checked"{{/if}} />
      ${title}
    </label>
  </li>
</script>

hover menuitems in wordpress

jQuery(document).ready(function() {
 
  jQuery(".menu-item img").hover(
    function () {
      if (jQuery(this).parents().hasClass("current_page_item")) return;
      jQuery(this).attr("src",jQuery(this).attr("src").replace(".png", "_over.png"));
    },
    function () {
      if (jQuery(this).parents().hasClass("current_page_item")) return;
      jQuery(this).attr("src",jQuery(this).attr("src").replace("_over.png", ".png"));
    }
  );
 
  var img = jQuery('.current_page_item img');
  img.attr("src",img.attr("src").replace(".png", "_active.png"));
 
});
jquery.txt · Last modified: 2015/05/23 09:11 by rick