I have a problem with my div element title. The following is my div element:
<div id="sampleDiv" runat="server" class="exStyle" onclick="return div_Click(this);" title="any"></div>
The following is my javascript:
function div_Click(btn) {
if (btn.title == "any") {
btn.title = "on";
btn.style.background = "url('sample1.png')";
}
else if (btn.title == "on") {
btn.title = "off";
btn.style.background = "url('sample2.png')";
}
else if (btn.title == "off") {
btn.title = "any";
btn.style.background = "url('sample3.png')";
}
return false;
}
and after changing the title to "on" or "off" from client side, the value of Attributes["title"] from c# code behind is still "any"!! Any help guys...
What are you trying to do? Since title is attribute it is never posted back to server. Only input element are posted back to server. There fore you are unable to get the changed value.
To bypassthis restriction you will have to add hiddenfield with runat server tag. update hiddenfield value to the div title before post and recover the value in your code behind by using hiddenfield. value.
Hope this is clear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With