Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
is there a way to replicate HTML code to shiny

I am trying to replicating the HTML code to shiny. But it does not work. But pure HTML without shiny works. Basically Whatever I put in the box, the typeof should return.

You can refer my previous post here Get type of value entered

library(shiny)
library(shinydashboard)
library(shinyjs)

ui <- dashboardPage(
  dashboardHeader(title = "Basic dashboard"),
  dashboardSidebar(collapsed = TRUE),
  dashboardBody(
    HTML('<p id="res">Value</p><input type="text" id="fname" name="fname"><br><br>'),
    tags$script(
      "document.getElementById('fname').addEventListener('input', e => {
  const value = e.currentTarget.value;
  const checkType = isNaN(Number(value)) ? value : Number(value)
  document.getElementById('res').textContent = typeof checkType
})"),
    useShinyjs(),
actionButton("release", "Release"))
    )


server <- function(input, output) {

  observeEvent(input$release,{
    # tags$head(tags$script("$('body').toggleClass('sidebar-collapse');"))
    toggleClass(selector = 'body', class = 'sidebar-collapse')
    # js$toggleCollapse()
  })
}

shinyApp(ui, server)
about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda