Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

Closed Unassigned: Adding Attribute to 'a' tag returns "Object doesn't support property or method 'attribute'." [10266]

$
0
0
Hi,

Small issue. I'm sure you'll know a resolution.

I'm using SPServices in a function that utilizes the GetListItems operation to grab a column value from the pages library for the current page. (A new custom column)

That whole chunk of the code works fine. The issue comes in when I try to use .attribute() to edit the href of a pre-made element in the page.

Here's my code, the faulty bit is line 19

```
$('#SGroup').attribute('href','http://idwebelements/GroupManagement.aspx?Group='+SGroups+'&Operation=join');
```

```
function securityGroup() {
var SGroups;
var index = window.location.pathname;
var currURL = index.split("/")[4];
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Pages",
CAMLViewFields: "<ViewFields><FieldRef Name='RequestSecurityGroup' /></ViewFields>",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='LinkFilename' /><Value Type='text'>"+currURL+"</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
SGroups = $(this).attr("ows_RequestSecurityGroup").split(";#")[1];
});
}
});
if (SGroups.length > 0) {
$('#SGroup').css('display','block');
$('#SGroup').attribute('href','http://idwebelements/GroupManagement.aspx?Group='+SGroups+'&Operation=join');
$('#SGroupText').css('display','block');
$('div#SGroupText span#SGroupName').text(SGroups);
} else {}
}
```
Comments: Not an issue.

Viewing all articles
Browse latest Browse all 6517

Trending Articles