Wednesday, March 27, 2013

Difference in eq() and :eq() : becomes significant in case nested div


below : first eq(4) gives 4 div ( including the outer one), where as :eq(4) gives fourth INNER div
this needs to be investigated.




<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="eq.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" src="jquery-1.7.2.min.js" type="text/javascript" ></script>
    <script type="text/javascript">
        $(document).ready(
        function() {
        $("div").eq(4).click(function() { alert("789"); });
        $("div :eq(4)").click(function() { alert("000"); });
        }
        );
       
    </script>
</head>
<body>
    <form id="form1" runat="server">
<div>
    <div>aaa</div>
    <div>bbb</div>
    <div>ccc</div>
    <div>ddd</div>
    <div>eee</div>
</div>
<script type="text/javascript">
    $("div").eq(2).click(function() { alert("123"); });
    $("div :eq(2)").click(function() { alert("456"); });
    </script>
    </form>
</body>
</html>

two ways of using jQuery eq() selector : note that eq selector is not there in CSS, it is a javascript extension. eq() method call is perfwise better in modern browsers



eq() selector is not a part of CSS specification
for better performance in modern browsers, use .eq() method instead.



<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){

  $("div:eq(1)").click(function(){alert("qqq");});
  $("div").eq(3).click(function(){alert("www");});
});
</script>
</head>
<body>
<div>aaa</div>
<div>bbb</div>
<div>ccc</div>
<div>ddd</div>
<div>eee</div>
<div>Messages will be displayed on clicking bbb,ddd, and eee above</div>
<script>
$("div").eq(4).click(function(){alert("vvv");});
</script>
</body>
</html>

jQuery difference between questions


Difference between two dates
append and after
click and live
append and appendto
live and bind
offset and position
prop and attr
html and append
remove and hide

Tuesday, March 26, 2013

jQuery animation


<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("div").animate({left:'250px'},5000);
$("div").animate({right:'250px'},5000);
    $("div").animate({backgroundColor: "#aa0000",
          color: "#cff",
          width: 500},5000);
$("div").text = "aaa";
   $("div").animate({backgroundColor: "#aa0000",
          color: "#fff",
          width: 100},5000);
  });
});
</script>
</head>

<body>
<button>Start 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 style="background:#98bf21;height:100px;width:100px;position:absolute;">
</div>

</body>
</html>

How to get or set the value of controls through jQuery




How to get or set the value of controls through jQuery

from w3schools : 

Get Content - text(), html(), and val()

Three simple, but useful, jQuery methods for DOM manipulation are:
  • text() - Sets or returns the text content of selected elements
  • html() - Sets or returns the content of selected elements (including HTML markup)
  • val() - Sets or returns the value of form fields

jQuery : making a button draggable : use draggable({cancel:false})









<!DOCTYPE html>
<html>
<head>
 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
 <script>
  $(function() {
$("#mydiv").draggable();
$("#mybutton").draggable({cancel:false});
  });
  </script>
</head>
<body>

<div id="mydiv" > sdfdsfds </div>
<input type="button" id="mybutton" value="Submit form" />
</body>
</html>

Sunday, March 17, 2013


Good list of cloud computing learning


This is list from http://weblogs.asp.net/sbehera/archive/2011/11/18/good-list-of-cloud-computing-learning.aspx


Comparing features of LangGraph vs CrewAI

LangGraph Orchestration vs CrewAI Orchestration The following table compares LangGraph and CrewAI orchestration across their menta...