March 26, 2012
Check if AJAX loaded form contain a submit button
Question by Merianos Nikos
Is there a way to check if the form that has been loaded with AJAX contain a submit button with jQuery ?
Answer by Darin Dimitrov
success: function(content) {
$('#someplaceholder').html(content);
var containsSubmitButton = $(':submit', content).length > 0;
}
Answer by Starx
You can do it as this
$("#div").load("yourpage", function() {
if($("#div").find(":submit").length > 0) {
console.log("yes");
}
});