1

I attempted to use some javascript to manipulate the attributes of an html tag, but I am not getting the results that I expect. The attribute remains on the element, despite there being nothing wrong with my javascript.

Specifically, I tried using the following javascript to remove the 'style' attribute from this tag:

<select tabindex="-1" class="selectized" style="display: none;">

The javascript below looks a little funny because it sits inside of an r-markdown document.

function doStuff() {
document.getElementById('tab').getElementsByClassName('selectized').removeAttribute('style');
}$(document).ready(doStuff)

Here is the important html bit (I could not copy and paste (I apologize), so I took a picture).

html snippet

  • Please learn to use the debugging tools in your browser. There would be an error message in the console that you should have quoted here. – Quentin Jun 12 '23 at 17:10
  • "The javascript below looks a little funny because it sits inside of an r-markdown document." — When producing a [mcve] you can fix that. – Quentin Jun 12 '23 at 17:10
  • "(I could not copy and paste (I apologize), so I took a picture)." — Don't do that. [Pictures of code](http://idownvotedbecau.se/imageofcode) or of [exceptions](http://idownvotedbecau.se/imageofanexception/) are not very helpful. Put a [mcve] and (if applicable) text of the exception in the question itself. – Quentin Jun 12 '23 at 17:10
  • The javascript does not yield an error. I stated in my post that there is nothing wrong with it. No, I cannot reveal much about the code for miscellaneous reasons. I apologize if what I provided is not enough for you. Yes, I realize that a picture is insufficient. However, I tried to expedite the process during a work day with the hope someone was familiar with the situation. – Justin Pretorius Jun 12 '23 at 18:00

0 Answers0