I have two divs called "Yes" and "No"
<div id="object">
<div class="object-content">
I'd say
<div class="confirm" id="btnYes" runat ="server" >Yes</div>
</div>
<div class="object-content" style="float: right">
I'd say
<div class="confirm" style="color: red" id="btnNo" runat="server">No</div>
</div>
</div>
And one Comment button called "Post"
<asp:Button ID="btnPostUrComment" OnClick="btnPostUrComment_Click" runat="server" Text="Post Your Comment" Height="33px" class="ppig" />
When I directly click on the "Post" I alert "Please select Yes or NO by clicking on them"
And click on the "yes" or "no" div I alert "You said "Yes" or "no" "
Now the problem is , after all this If I click "yes" div then the "no" div will be disable not hide before click on "Post" button and vice versa .
I am trying some script. Please guide me.
<script>
$(document).ready(function () {
var IsPostComment = false;
var clickedElement = "";
$('.confirm').click(function () {
IsPostComment = true;
clickedElement = $(this).text();
});
$('#<%=btnPostUrComment.ClientID %>').click(function () {
if (IsPostComment) {
alert("You Said " + clickedElement);
} else {
alert("Please select Yes or NO by clicking on them")
return false;
}
});
});
</script>