Quotation marks in Html - Id(variable) - working in Sketchup Ruby Code Editor

(Please post your Ruby questions in the Ruby API subcategory.)


Is the variable a Ruby or JavaScript reference ?

What single quotation marks ?

… ie, we cannot read minds. :roll_eyes:


If Ruby, then you must use a double-quoted string in order to do interpolation.

I explained this in the other topic thread.

# Ruby

dlg.execute_script(
  %[document.getElementById("#{ruby_id}").innerHTML="#{ruby_value}";]
)

I again point you to the Ruby Core primer on String literals …

https://ruby-doc.org/core-2.5.5/doc/syntax/literals_rdoc.html#label-Strings


If you are doing this within JavaScript, … (which I doubt because you said your are using a SketchUp Editor extension,) … you just use a string reference that holds string ID.