Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to checked checkbox which is loaded thru ajax?

This method does not work because checkbox is not in the DOM:

$('input[type=checkbox][name=rememberme]').prop('checked', true);

I don't know how to use .on() because I do not need to bind event:

$(elements).on( events [, selector] [, data] , handler );

How to checked checkbox which is loaded thru ajax using jQuery?

like image 912
webvitaly Avatar asked Jun 11 '14 05:06

webvitaly


People also ask

How can I get checkbox checked value in Ajax?

Use the method is() with property :checked . var parameters = { 'security':$('input[name="security"]').is(':checked'), };


1 Answers

$( document ).ajaxComplete(function() {
  $('input[type=checkbox][name=rememberme]').prop('checked', true);
});

Try this:

like image 163
Rohit Batham Avatar answered Nov 14 '22 23:11

Rohit Batham