Wednesday, May 4, 2011

JQuery Samples

Tutorials
http://www.w3schools.com/jquery/default.asp

1) Print all input controls in page
$(":input")

only visible controls
$(":input:visible")

to known count of visible items
$(":input:visible").size()

2) Print all input controls with value in xml tags

var str='';
$(":input:visible").each(function(){
str+='<'+this.id+'>'
str+=$(this).val();
str+=''
})
console.log(str)

2) checkbox item checked or not

$('#chkShowPassword').is(':checked') ? alert('checked'); : alert('unchecked');

No comments:

Post a Comment