If no uploaded document, change the classname in views

Support MB Views If no uploaded document, change the classname in viewsResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31482
    JamesJames
    Participant

    Hi, Metabox. I would like to ask for help. How can I achieve/convert this using JQuery in views? So basically I want to create a statement if there is no document uploaded I want to change a axisting class inside existing HTML element (div).

    {% if post.upload_documents is empty %}
        (I want to target the specific class from HTML element, add class and remove other class)
    {% else %}
        (No action)
    {% endif %}

    Thanks in advanced

    #31488
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Here is an example to create jQuery code in View https://stackoverflow.com/questions/35845484/using-jquery-with-twig

    You can add your own script code in the <script> tag.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.