jquery - Undefined when selecting rel value using class -


i using uikit template. have 2 buttons toggle between. when click on 1 button class uk-active. when try rel attribute value using jquery on form submit, says undefined. code below

<button class="uk-button uk-width-1-2 uk-active" rel="0" type="button"><span class="fbaicon"></span> rent</button> <button class="uk-button uk-width-1-2" rel="1" type="button"><span class="fbaicon"></span> buy</button> 

and jquery is,

var type = $('.uk-active').attr('rel'); alert(type); 

i sure class uk-active exists 1 of these 2 buttons

check whether code executing before dom loaded. keep scripts in $(document).ready();


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -