I have a the following html piece :
<div onClick="javascript:getComments(this);" store-id="143568" class="CountryRow" style="padding: 4px;"><div class="flag flag_az"></div> Azerbaijan</div>
and I would like to create a jquery function to get the value of store-id
. I have the following however its not working :
getComments = function(input) {
fValue = $(input).val( $(input).attr("store-id") );
alert('the ID :'+fValue);
}
can someone be kind enough to tell me what it is that I am doing wrong.
This works perfectly:
getComments = function(input) {
fValue = $(input).attr("store-id");
alert('the ID :'+fValue);
}
http://jsfiddle.net/mHBuE/
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