cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Change CSS class of a button

micah
14-Alexandrite

Change CSS class of a button

I'm trying to create a function which removes the class of a button and then adds another class:

$scope.tutorialShow = function () {
 angular.element(document.querySelector("[widget-id=instructionInfoButton] button")).removeClass("test").addClass("button");
}

 

I'm not sure the error in my code.

ACCEPTED SOLUTION

Accepted Solutions
WilsonT
14-Alexandrite
(To:micah)

Hi Micah,

 

Can you try the following?

$scope.tutorialShow = function () { 
  $scope.setWidgetProp('instructionInfoButton','class',undefined);
  $scope.setWidgetProp('instructionInfoButton','class','button');
}

 

 

View solution in original post

2 REPLIES 2
WilsonT
14-Alexandrite
(To:micah)

Hi Micah,

 

Can you try the following?

$scope.tutorialShow = function () { 
  $scope.setWidgetProp('instructionInfoButton','class',undefined);
  $scope.setWidgetProp('instructionInfoButton','class','button');
}

 

 

rabernathy
12-Amethyst
(To:micah)

I believe the quotes around the widget id are not correct in your code.  Here is an example from an experience I've created:

 

angular.element(document.querySelector('[widget-id="PartIDListGrid"] .row:nth-child(2)')).addClass("SelectedItem");

 

I think yours should be (I didn't test):

 

angular.element(document.querySelector('[widget-id="instructionInfoButton"] button')).removeClass("test").addClass("button");

  

Announcements

Top Tags