Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:20:35+00:00 2026-05-30T07:20:35+00:00

I have a form with a Jquery plugin requirement that creates a form input

  • 0

I have a form with a Jquery plugin requirement that creates a form input field with a type of Facebook-autocomplete kind of style:

<%= javascript_include_tag "form_prettify_library" %>

<div class="box">
  <ul id="first_form" class="tagit">
      <li class="prettify-new"></li>
  </ul>
    <%= form_for @brand do |f| %>
    <%= f.hidden_field :tag_list, :value => @brand.tags_from(current_user).join(", "),
                                  :id => "mytaglist" %>
    <%= f.submit "Add tags" %>
    <%= f.error_messages %>
    <% end %>
</div>

It works well, however without JavaScript the form doesn’t work because the form above only has a hidden_field and no visible entry field (the entry field is created by the plugin inside of the tags), and I need this to work without JavaScript on mobile devices. Is there any way to show the code above if JavaScript is loaded, otherwise the code below will be displayed if it isn’t?

<div class="box">
  <%= form_for @brand do |f| %>
    <%= f.label :tag_list, "Your tags" %>
    <%= f.text_field :tag_list, :value => @brand.all_tags_list %>
    <%= f.submit "Add tags" %>
  <% end %>
</div> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:20:36+00:00Added an answer on May 30, 2026 at 7:20 am

    Yes, use css to hide it by default, and add a class to the site when js is enabled

    html

    <body class="no_js">
    <script type="text/javascript">
    (function() {
       var body = document.getElementsByTagName("body")[0];
       body.className = body.className.replace(/\bno_js\b/, " js ")
    }())
    </script>
    

    css

    .no_js .jsForm,
    .js .no_jsForm  {
       display:none;
    }
    
    .js .jsForm,
    .no_js .no_jsForm  {
       display: block;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form field which uses Jorn Zaefferer's autocomplete jQuery plugin. If i
i have a form with input type=file. it submits using ajax (plugin jquery form
I have a small jQuery plugin that I use for form AJAX validation. There
I have a form that I pre-populate with test data though jQuery. $('INPUT[name=subscription.FirstName]').val('Jef'); but
I have a form where users can add input fields with jQuery. <input type="text"
I have a form that is using jQuery Validate plugin for client side validation,
I have a form that uses the excellent jQuery validation plugin. This is a
Using the jQuery plugin found here: http://docs.jquery.com/Plugins/Validation I have a form, that when certain
Total beginner question about jQuery: I have a Form that contains several TextBoxes (input
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.