My Sites


Wednesday, June 17, 2015

Everyday jQuery

http://api.jquery.com/val/
$( document ).ready(function() {

});


$( "#myDiv" ).css( "border", "3px solid red" );

$("#txtEmail").val()

$("#txtEmail").val("something")


$('#some_id').on('change', function() {

  alert( this.value ); // or $(this).val()

});


var thisvalue = $(this).find("option:selected").text();

$("input[type='checkbox']").val();  or $('#check_id').val();


$( "#target" ).click(function() {
      alert( "Handler for .click() called." );
});

https://www.youtube.com/watch?v=G-POtu9J-m4&index=12&list=PLoYCgNOIyGAB_8_iq1cL8MVeun7cB6eNc
http://api.jquery.com/on/

$( "#dataTable tbody tr" ).on( "click", function() {
console.log( $( this ).text() );
});

$( "li" ).each(function( index ) {

  console.log( index + ": " + $( this ).text() );

});

Date object has list of dates
$.each(data.dates, function(index, element) {
    alert(element.timeStamp);
});


var markers = [{ "position": "128.3657142857143", "markerPosition": "7" },

               { "position": "235.1944023323615", "markerPosition": "19" },

               { "position": "42.5978231292517", "markerPosition": "-3" }];


$.ajax({

    type: "POST",

    url: "/webservices/PodcastService.asmx/CreateMarkers",

    // The key needs to match your method's input parameter (case-sensitive).

    data: JSON.stringify({ Markers: markers }),

    contentType: "application/json; charset=utf-8",

    dataType: "json",

    success: function(data){

           alert(data);

           $('#target').html(data.msg);

},

    failure: function(errMsg) {

        alert(errMsg);

    }

});


var  formData = "name=ravi&age=31";  //Name value Pair    or

var formData = {name:"ravi",age:"31"}; //Array



$.ajax({

    url : "AJAX_POST_URL",

    type: "POST",

    data : formData,

    success: function(data, textStatus, jqXHR)

    {  },

    error: function (jqXHR, textStatus, errorThrown)    {}

});


http://hayageek.com/jquery-ajax-post/


<input type="checkbox" name="checkboxname" value="check2"> check2
<input type="radio" name="r" value="radio1"> radio1


$(".tdBody").html(" ");
$( ".tdBody" ).append( "<input type=\"text\"/>" );
$('#editBtn').hide();






No comments:

Post a Comment