vinzi vinzi - 3 months ago 6x
Javascript Question

how to make 2 condition in button clicked jquery

hello is that possible to make a two condition from 1 button clicked?

if(unable == 4) {
$("#formitem").submit(function () {
var message = "<?=$message_change_location?>";
var resotid = <?=$restaurant_info["restaurant_id"]?>;
var restoname = "<?=$restaurant_info["restaurant_name"]?>";
var restomenu = "<?=$restaurant_menu?>";
var postal = "<?=$postal?>";
var delivery_no = "<?=$delivery_no?>"
type: "GET",
url: "/ajax/order_unable",
dataType: 'html',
data: {
message_change_location: message,
restid: resotid,
restname: restoname,
restmenu: restomenu,
postal: postal,
delivery_no: delivery_no,
success: function (res) {

return false;
}else if($("#second_notif") == "show"){
$("#formitem").submit(function () {

i want to make a condition if
is showed, than if i click
for the second times will show the alert. The first click will show pop up windows, and there is not any problem here,

in the pop up windows there is a script to show the
, with this following code :

$(document).ready(function() {
$("#change_location_2").click(function () {
return true;


and there in same page on where to show the pop up windows there is a code to show the
too :

return true;

here is the view for the

<div id="second_notif" style="display:none;">
<?php $this->load->view('MAIN/'.country_code.'/search');?>

i can show the pop up windows, and show the
when i clicked
button, but when the
has beeb showed, why if i clicked the same button again, why i cant show the alert?
guys can you help me how to show the alert?

p.s alert is not my goal, i will change the alert to other view
please help me guys, thank you (:


First of all, you only need one event handler for this method. You can then move your conditionals into the handler.

Secondly, your condition $('#second-notif') == 'show' will not work, as is will never evaluate to true. To test if an element is visible using jQuery, use the .is(':visible') method. Here's a quick example of what you're looking for: