Showing posts with label Javascript and JQuery. Show all posts
Showing posts with label Javascript and JQuery. Show all posts

Tuesday, February 25, 2014

TextBox Change Event In Jquery

Method 1 : TextBox Change Event In Jquery


$( "#id" ).change(function() {
console.log('I am pretty sure the text box changed Change Event');
});

Method 2 : TextBox Change Event Based On Keyboard In Jquery


$("#id").on('change keyup paste', function() {
console.log('I am pretty sure the text box changed');
});

OR
$('#id').keyup(function () {
console.log('I am pretty sure the text box changed');
});

Method 3 : TextBox Change Event Bind On All In Jquery


$('#id').bind('focus blur select change click dblclick mousedown mouseup mouseover mousemove mouseout keypress keydown keyup', function(e) {
console.log('I am pretty sure the text box changed');
});

Tuesday, December 17, 2013

Serialize form in jquery Example

Serialize form in jquery Example : HTML Form


<form id='d34' class='form_example' name='customercontact' method='post' action='customerUpdate.php'>
Form <br />
Name: <input type='text' name='name' class='textbox' value=''><br />
Number: <input type='text' name='number' class='textbox' value=''><br />
E-mail: <input type='text' name='contact_email' class='textbox' value=''><br />
</form>
<br><br>
<button id="form_save">Main button</button>

Serialize form in jquery Example : JQuery Code


$(document).ready(function() {
$('#form_save').click(function(e){
e.preventDefault();
$.each($('form.customer_contact'), function(index) {
var sData = $(this).serialize();
$.ajax({
type: "POST",
url: "updateCustomer.php",
data: sData,
success: function(someMessageFromPhp) {
alert(someMessageFromPhp);
}
});
});
});
});