mardi 24 mai 2016

Single if Condition fails when adding comparisons

I have two hidden inputs on different page and i am checking the results on the base of each input value but its worked in case of single comparison if i add to comparison in my if condition its stop work. anyone check and point out the issue what wrong am doing.

code is as follows:

<input type="hidden" id="product_id" value="137">
<input type="hidden" id="product_id" value="195">

JS:

var product_ids = jQuery('#product_id').val();
  if(parseInt(product_ids) == 195 || parseInt(product_ids) ==  137){
  alert ("i am working");
}

Aucun commentaire:

Enregistrer un commentaire