jQuery(document).ready(function($){
$('.myclass').keyup(function(eventObject){
console.log("!")
var searchTerm = $(this).val();
if(searchTerm.length > 2){
if(eventObject.keyCode == 13){
$('#sendform input[name="s"]').val(searchTerm);
goSubmit();
return;
}
$.ajax({
url : '/wp-admin/admin-ajax.php',
type: 'POST',
data:{
'action':'',
'term' :searchTerm
},
success:function(result){
} });
}
$("#mybutton").click(function(){
if(($('#sendform input[name="s"]').val().length) == 0){
return false;
} else {
$('#sendform input[name="s"]').val($('.myclass').val());
goSubmit();
}
}) });
function goSubmit(){
if(($('#sendform input[name="s"]').val().length) == 0){
return false;
} else {
$('#sendform').submit();
}
}
});
$("#mybutton").click(function(){
$('#sendform input[name="s"]').val(searchTerm);
goSubmit();
}) });
$('#sendform input[name="s"]').val(searchTerm);
$('#sendform input[name="s"]').val(searchTerm);
$('.myclass').keyup