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
Post a Comment