hi im trying to get the rel value of a button that is click:
function forwardStep()
{
$("#forwardStep").bind("click", function(){
var page = $(this).attr('rel');
thats pretty much the basis but is return "undifined". Do you know why?
Regards Phil Jackson
If you're using a button with an ID, then you shouldn't have to get any extra data from the rel attribute since the function is unique to your button.
But if you have other reasons, then you just need to make sure your button itself has a rel attribute defined, e.g.
<input id="forwardStep" rel="test" type="button" value="forward" />
and your function is closed properly
$(document).ready(function(){
$('#forwardStep').bind('click',function(){
var page = $(this).attr('rel');
alert(page);
})
})
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