Changing an element's ID with jQuery
Your syntax is incorrect, you should pass the value as the second parameter:
jQuery(this).prev("li").attr("id","newId");
A PREFERRED OPTION over .attr
is to use .prop
like so:
$(this).prev('li').prop('id', 'newId');
.attr
retrieves the element's attribute whereas .prop
retrieves the property that the attribute references (i.e. what you're actually intending to modify)
What you mean to do is:
jQuery(this).prev("li").attr("id", "newID");
That will set the ID to the new ID