Drompo2 Posted August 24, 2011 Share Posted August 24, 2011 I have a function that grabs the title from a li and split what ever the title up that is seperated by a '|' function RemoveFunction(data) { var get = $(data).attr("class"); var getitem = $(data).closest("li"); var cat = $(getitem).attr("title"); console.log($(cat)); var cats = cat.split('|'); This just returns blank on console, but yet console.log($(getitem).attr("title")); Outputs correctly in console :s Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/245628-jquery-attr-error/ Share on other sites More sharing options...
nogray Posted August 24, 2011 Share Posted August 24, 2011 You are trying to get an HTML element in console.log($(cat)); // you are using the $ function cat is a string, so you shouldn't use the $ function on it. Quote Link to comment https://forums.phpfreaks.com/topic/245628-jquery-attr-error/#findComment-1261591 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.