0
I have a code that when I click the button to deactivate photo it makes disappear the button that is next. To get this function to work, I had to pass in id a few characters before, it was like this:
<a href="javascript:void(0);" id="semEmi<?= $l->img_id ?>"></a>
in id that part that is written (semEmi) I put for the button to do its function. However, when I click on this button, before deactivating the photo, it picks up these characters (semEmi), it does not work. I don’t know how to remove these characters when clicking this button. My code is in MVC
Here is the Javascript that makes the functions by clicking on it:
$(document).on('click', '.semEmi', function () {
var t = $(this);
$.SmartMessageBox({
title: "<?= $this->lang->line("
con_inflaud_jus_msg_title "); ?>",
content: "<?= $this->lang->line("
con_inflaud_jus_msg_d "); ?>",
buttons: "[<?= $this->lang->line("
con_inflaud_jus_msg_btn_n "); ?>][<?= $this->lang->line("
con_inflaud_jus_msg_btn_y "); ?>]",
input: "text",
inputValue: "",
placeholder: "<?= $this->lang->line("
con_inflaud_jus_msg_place "); ?>"
}, function (ButtonPress, Value) {
if (ButtonPress == "<?= $this->lang->line("
con_inflaud_jus_msg_btn_n "); ?>") {
return 0;
} else {
if (Value == "") {
notifica('<?= $this->lang->line("con_inflaud_msg_erro_title"); ?>', '<?= $this->lang->line("con_inflaud_jus_msg_inpmpt"); ?>', 4000);
} else {
$.ajax({
type: "POST",
url: "Controller/Funcao/" + $(t).attr('id') + "/2",
data: {
justificativa: Value
},
dataType: "json",
success: function (r) {
if (r) {
$(t).parent().parent().next().find('.graf_lau').show();
$(t).parent().parent().next().find('.blockquote').show();
$(t).parent().parent().next().find('.img_lau_d').show();
$(t).parent().parent().next().find('.img_lau_a').css('display', 'none');
$(t).removeClass('semEmi btn-default');
$(t).addClass('comEmi btn-warning');
$(t).empty();
$(t).append('<span class="btn-label"><i class="fa fa-check-square-o"></i></span><?= $this->lang->line("con_inflaud_afe_comEmi"); ?>');
} else {
notifica('<?= $this->lang->line("con_inflaud_msg_erro_title"); ?>', '<?= $this->lang->line("con_inflaud_msg_erro_d"); ?>', 4000);
}
}
});
}
}
});
});
You want us to
"Controller/Funcao/" + $(t).attr('id') + "/2"
theid
contains only the numbers, without the stringsemEmi
, that’s it ?– DontVoteMeDown
That’s right @Dontvotemedown
– Ketlin
Use
$(t).attr('id').replace("semEmi", "")
– DontVoteMeDown