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? 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. Link to comment https://forums.phpfreaks.com/topic/245628-jquery-attr-error/#findComment-1261591 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.