Leverage JavaScript or CSS to create a paper button without the ink effect

Currently, I am utilizing JavaScript to dynamically create paper-buttons in the following manner:

function createButtons(dieDefaults) {
for(var i = 0; i < dieDefaults.length; i++) {
    var btn = document.createElement("paper-button");

    var txt = document.createTextNode(dieDefaults[i]);
    btn.className += "smallButton";
    btn.onclick = function() {
        document.getElementById("sidesInput").value = this.firstChild.nodeValue;
        checkInput(btn);
    }
    btn.appendChild(txt);
    document.getElementById("dieDefaultDiv").appendChild(btn);
}
}

When I create a paper-button using

var btn = document.createElement("paper-button");
, I am unsure how to include noink or raised. I am open to using CSS for styling, however, including --paper-button-raised: true; within:

  paper-button{
color: var(--paper-blue-grey-100);
background: var(--paper-indigo-500);
--paper-button-raised: true;}

has not been effective. Any suggestions on how to address this?

Answer №1

To apply the properties noink and raised to the btn element, you can do it like this:

btn.noink = true;
btn.raised = true;

<head>
  <base href="https://polygit.org/polymer+1.7.0/components/">
  <script src="webcomponentsjs/webcomponents-lite.min.js"></script>
  <link rel="import" href="polymer/polymer.html">
  <link rel="import" href="paper-button/paper-button.html">
</head>
<body>
  <script>
    HTMLImports.whenReady(function() {
      var btn = document.createElement('paper-button');
      btn.textContent = 'Hello';
      btn.noink = true;
      btn.raised = true;
      btn.onclick = function() {
        console.log('clicked');
      };
      document.body.appendChild(btn);
    });
  </script>
</body>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to use Selenium IDE to navigate if a variable contains a specific string

Thank you for taking the time to review this. I have developed a script that scans a web page to verify if a specific text string is present. If it is not found, the script will loop. The issue I am facing is that I am required to input every single word ...

Equal Sized <li> elements within Bootstrap Cards

I've been working with the following "template", and there are multiple cards like this on the settings page I'm currently developing. <!-- Card template --> <div class="card mt-3 shadow-sm"> <div class="card-hea ...

PhantomJS 2.0.0 not delaying page loading

In the script provided, there is an array of URLs called links. The function gatherLinks() is designed to collect additional URLs from the sitemap.xml file related to the ones in the links array. Once the number of URLs in the links array reaches a certain ...

Tips for passing navigator reference to React Native's <Drawer/> component?

Utilizing react-native-drawer ( https://github.com/root-two/react-native-drawer ) in my index.ios.js file, I have the following setup where I am attempting to pass the 'navigator' reference into the <DrawerPanel /> of <Drawer /> compo ...

Attempting to modify information in vue.js

I have been facing an issue with overriding data in the App.vue component. It seems that every time I try to update the data in my main.js file, the component still takes the default data. I am working with webpack as well. App.vue <template> & ...

|Webview|Best Practices for Integrating Upload Script

I am currently developing an Android app using WebView and I need to implement a code for uploading on Android. I came across the following code snippet and I want to convert it into JavaScript instead of Java (if possible). It needs to be linked to the up ...

Ways to showcase a location on a map

Seeking a method to visually represent users' locations on a world map using HTML, JavaScript, or any other suitable approach. The data will be extracted from an Excel file and consists of the City Name only. Each user's location should be marked ...

Issue with MVC 4 Asynchronous File Upload: Controller Always Receiving Null Value

I'm encountering an issue while attempting to upload a file asynchronously from ajax to my controller. I am passing 3 variables - PictureId, PictureName, and PictureFile. The problem specifically lies with the "PictureFile" variable as it consistently ...

Sass: Overcoming the challenge of the IE limitation on 4095 selectors per stylesheet

Hey there! Are you working on a Rails project with Sass & Compass? If you're using the Rails Asset Pipeline, check out this question. We're in the process of developing a large application with multiple use cases and various individually styled ...

What steps can I take to stop the comments section on my WordPress website from taking up the entire screen?

After launching my WordPress website, I noticed that the comments section under each post is stretching across the entire width of the screen, instead of aligning with the margins like the rest of the page. Can someone advise on how to adjust the margins ...

What is the best way to generate a new div element when the content exceeds the preset height of the current div?

CSS .page{ width: 275px; hight: 380px; overflow: auto; } HTML <div class="page">dynamic text</div> Is there a way to automatically create new div elements when dynamic text overflows past the fixed height of the init ...

What is the best way to align a series of divs vertically within columns?

Struggling to find the right words to ask this question has made it difficult for me to locate relevant search results. However, I believe a picture is worth a thousand words so...https://i.stack.imgur.com/LfPMO.png I am looking to create multiple columns ...

What is the best way to send JSON data from Express to a JavaScript/jQuery script within a Pug template?

Currently, I am facing a challenge in passing JSON data from an Express route to a .js file located within a .pug template. I have been attempting to solve this issue using the following method: The router: // Office Locations router.get('/office_lo ...

Is there a way to connect a function to a div using anchor tags that mimic a dropdown menu?

Here is the HTML code for a navigation bar that I have created <div class="navbar"> <a href="#home">Home</a> <div class="dropdown"> <button class="dropbtn">Categories ...

Integrating redux-form with the react-widgets DateTimePicker component

I am currently working on a project using ReactJS with Redux and I am trying to incorporate a form similar to the one shown in this example: Most of the components are working well, but I am encountering an issue with the DateTimePicker due to the momentL ...

Customizing the arrow of a Bootstrap tooltip and adjusting its positioning

I've implemented a bootstrap tooltip to show an image in it. So far, I've been successful in achieving this. https://i.sstatic.net/hgzyL.png However, my current requirement is as follows: https://i.sstatic.net/xcxWZ.png I would like to adjust ...

The authentication0 router fails to initiate navigation

I'm currently using Auth0 in combination with Angular 2. The issue I am encountering is that my login code isn't redirecting to the home page after authentication. Based on my understanding, Auth0 does not handle the redirection process itself. ...

placeholder for dropdown selection in Vue.js version 2.0.0

Currently, I am in the process of developing a web application using vuejs 2.0. In order to create a straightforward select input, I employed the following code: <select v-model="age"> <option value="" disabled selected hidden>Select Age&l ...

Bringing the Jquery cursor into focus following the addition of an emoji

Looking to add emojis in a contenteditable div but facing an issue with the cursor placement. Here is a DEMO created on codepen.io. The demo includes a tree emoji example where clicking on the emoji adds it to the #text contenteditable div. However, after ...

Utilizing Dojo widgets in Xpages

I'm having trouble applying CSS to certain dojo elements within my Xpage. Here is the CSS style sheet I am using: .formFields { color: rgb(5, 56, 107); font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: nor ...