jeudi 9 avril 2015

How to find the div id name?


Vote count:

0





<div id="container">
<div class="dice" id="dice"></div>
<div id="main_div"></div>
</div>


1)In "#main_div" i have inserted 100 div's with different id's by using jquery. 2)Check the below code.



$(".dice").click(function(){
i = Math.floor(Math.random() * images.length);
$(".dice").html("<img src='"+ path + images[i] +"'>");
total = (i + 1);
player_A += total;
$("#main_div div").each(function(){
var $id_value = $("div").attr('id');
if($id_value == container){
alert("yes");
}else{
alert("No");}
});
});


3)If i click ".dice" continuously "player_A" value is increased. 4)What i want exactly is if "player_A" value is equal to the "#main_div div" "id" value, i need alert("Yes") or that "id" block BG changed. 5)Please check the below link. 6)fiddle is here



asked 49 secs ago







How to find the div id name?

Aucun commentaire:

Enregistrer un commentaire