# Disable opacity option for just eraser tool

**URL:** <https://pdfjs.community/t/disable-opacity-option-for-just-eraser-tool/139>\
**Category:** Technical Support\
**Created:** [July 15, 2020, 2:04pm UTC](https://pdfjs.community/t/disable-opacity-option-for-just-eraser-tool/139 "2020-07-15T14:04:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek11.maurya199](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@abhishek11.maurya199](https://pdfjs.community/u/abhishek11.maurya199)\
**Post date:** [July 15, 2020, 2:04pm UTC](https://pdfjs.community/t/disable-opacity-option-for-just-eraser-tool/139/1 "2020-07-15T14:04:47Z")

</div>

Hello,

Is it possible to disable/remove opacity option for just eraser tool and keeping it default as 100%.  
I tried it using instance.disableElements() but it disable opacity for every tool.  
Also for setting opacity to 100% always i tried instance.Tools.EraserTool.prototype.setStyles  
but it doesn’t set opacity to 100% automatically.

So is there any solution or work around?

Regards  
Abhishek Maurya

---

<div class="post-metadata">

**Author:** ![zzhang](https://avatars.discourse-cdn.com/v4/letter/z/b9e5f3/32.png) [@zzhang](https://pdfjs.community/u/zzhang)\
**Post date:** [July 16, 2020, 6:01pm UTC](https://pdfjs.community/t/disable-opacity-option-for-just-eraser-tool/139/2 "2020-07-16T18:01:29Z")

</div>

Hi,

One way to achieve this is to listen to the [toolModeUpdated](https://pdfjs.express/api/CoreControls.DocumentViewer.html#event:toolModeUpdated__anchor) event and disable the slider when it’s the current tool is the eraser tool, and re-enable the slider back when the current tool becomes others.

Best Reagrds,  
Zhijie

---

<div class="post-metadata">

**Author:** ![abhishek11.maurya199](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@abhishek11.maurya199](https://pdfjs.community/u/abhishek11.maurya199)\
**Post date:** [July 16, 2020, 6:18pm UTC](https://pdfjs.community/t/disable-opacity-option-for-just-eraser-tool/139/3 "2020-07-16T18:18:26Z")

</div>

Hello @zzhang,  
I can disable slider using document.getelementby class name as there is no  
data-element associated with it, but could you please tell me  
how can i set opacity to 100% before disabling slider?

Regards  
Abhishek Maurya

---

<div class="post-metadata">

**Author:** ![zzhang](https://avatars.discourse-cdn.com/v4/letter/z/b9e5f3/32.png) [@zzhang](https://pdfjs.community/u/zzhang)\
**Post date:** [July 22, 2020, 3:18pm UTC](https://pdfjs.community/t/disable-opacity-option-for-just-eraser-tool/139/4 "2020-07-22T15:18:28Z")

</div>

Hi,

The next version of express will add `data-element` to sliders so you can use `instance.disableElements` to remove it when the eraser tool is selected.

Thanks,  
Zhijie

---

<div class="post-metadata">

**Author:** ![zzhang](https://avatars.discourse-cdn.com/v4/letter/z/b9e5f3/32.png) [@zzhang](https://pdfjs.community/u/zzhang)\
**Post date:** [July 22, 2020, 3:18pm UTC](https://pdfjs.community/t/disable-opacity-option-for-just-eraser-tool/139/5 "2020-07-22T15:18:34Z")

</div>


