Monday, November 25, 2013

JQuery

        Below are the few useful statement, commands in JQuery.

Click on the item below to go through the description about that.

Disable the Control:

Disable the HTML controls like button, checkbox, textbox.
                    
$('#btn_submit').attr("disabled", true);
                    
                

Define the click event action:

Define the set of statements to be executed on click of control.
                    
$(document).ready(function () {
    $("#btn_submit").click(function () {
      // Click event action
    });
});
                    
                

Slide Taggle:

Slide taggle the content.
                    
$(".OnlineTable").slideToggle("slow");
                    
                

Get is checkbox checked:

Get the checkbox value. True, if checked. False, if unchecked.
                    
if($("#tdCheckBox").checked) {
    alert("Checked.");
}
else {
    alert("Unchecked.");
}
                    
                

Append the HTML tags:

Append the HTML tags inside another tag. In below example, <tr> tag is inserting into the <table> tag.
                    
$("#detail_table").append(
    "<tr>" +
    "<td class='thCheckbox' style='text-align:center;'>" +
    "<input type='checkbox' class='tdCheckBox' checked disabled /></<td>" +
    "<td><a class='anchor'>Full Name</a></td>" +
    "<td>E-Mail Id</td>" +
    "<td style='display:none;'>SSN</td>" +
    "</tr>"
);
                    
                

No comments:

Post a Comment