Resolving the Problem of Overlapping with Kendo UI Tabstrip and jQuery Tooltipster

Utilizing MVC4 and Kendo tabstrip along with jQuery Tooltipster to display validation messages.

Encountering an issue where the validation message from Tab 1 overlaps on Tab 2 due to z-index. Attempts to set z-index for tooltipster-base have been unsuccessful.

The HTML code structure is as follows:

<div id="tabstrip">
    <ul> 
      <li>Tab 1</li>
      <li>Tab 2</li>
    </ul>
    <div><form id="myform">
    <input type="text" name="field1" />
    <input type="text" name="field2" />
    <br/>
    <input type="submit" />
</form></div>
    <div><form id="myform2">
    <input type="text" name="field3" />
    <input type="text" name="field4" />
        <br/>
    <input type="submit" />
</form></div>
  </div>

Script:

$(document).ready(function () {
    var tabstrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");
    tabstrip.select(0);

    // initialize tooltipster on text input elements
    $('#myform input[type="text"]').tooltipster({
        trigger: 'custom',
        onlyOne: false,
        position: 'right'
    });

    $('#myform2 input[type="text"]').tooltipster({
        trigger: 'custom',
        onlyOne: false,
        position: 'right'
    });

    // initialize validate plugin on the form
    $('#myform').validate({
        errorPlacement: function (error, element) {
            $(element).tooltipster('update', $(error).text());
            $(element).tooltipster('show');
        },
        success: function (label, element) {
            $(element).tooltipster('hide');
        },
        rules: {
            field1: {
                required: true,
                email: true
            },
            field2: {
                required: true,
                minlength: 5
            }
        },
        submitHandler: function (form) { // for demo
            alert('valid form');
            return false;
        }
    });

    // initialize validate plugin on the form2
    $('#myform2').validate({
        errorPlacement: function (error, element) {
            $(element).tooltipster('update', $(error).text());
            $(element).tooltipster('show');
        },
        success: function (label, element) {
            $(element).tooltipster('hide');
        },
        rules: {
            field3: {
                required: true,
                email: true
            },
            field4: {
                required: true,
                minlength: 5
            }
        },
        submitHandler: function (form) { // for demo
            alert('valid form');
            return false;
        }
    });


});

Please review this issue on: JSFiddle: http://jsfiddle.net/vishalvaishya/bCZWd/2/

Assistance needed in setting appropriate CSS styles.

Answer №1

I managed to find the solution on my own. It may be beneficial for others facing a similar issue.

I made some updates to the logic of tooltipster.

An additional option (appendTo) has been included to position the tooltip over a specific element only:

c = {
     animation: "fade",
     appendTo: "body", 
     arrow: true,
... 

I also modified the parameter of tooltipster.appendTo('body') in the showTooltip function like this:

tooltipster.appendTo($(l.options.appendTo));

Usage:

$('#profileForm input[type="text"]').tooltipster({
        trigger: 'custom',
        onlyOne: false,
        position: 'right',
        appendTo: '#profileForm'        
});

This allows you to use tooltipster on different kendo-tabs or different divs.

View on JSFiddle:

Previous : http://jsfiddle.net/vishalvaishya/bCZWd/2/

Working : http://jsfiddle.net/vishalvaishya/bCZWd/3/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a dynamic dropdown menu that displays options based on the selection made in a previous drop

Attempting to replicate this exact functionality on my own site has proven difficult. Despite success on jsfiddle, none of the browsers I've tested seem to cooperate. Any suggestions? Even when isolated as the sole element on a page, it simply refuses ...

Is the use of the auto image attribute height/width impacting rendering performance?

Currently, I am facing an issue with setting the height and width attributes for an image as I do not have access to its dimensions from the server. One solution I am considering is setting both the width and height values to auto. For example: img { ...

React Images: Carousel display issue with images not centered

Is there a way to center the selected image instead of it appearing on the left-hand side? Here is the current behavior: https://i.stack.imgur.com/SUWOK.jpg I am using the following packages in a sandbox environment with Next.js 11 and TailwindCSS 2.2.4: ...

Utilizing inline styles with the asset pipeline feature in Rails

<%= link_to root_path do %> <div class=""> <div style="background-image:<%= image_tag " image1.png "%>"> </div> <div> <h2>Title</h2> <p>Paragraph</p> </div& ...

Steps for creating a resizable and automatically hiding side menu

I am working on a side menu that can be resized, and I want it to collapse (set to zero width) when it is empty. I have considered implementing one of these features individually, but I'm not sure how to make both work together. Is there a way to ad ...

Creating a versatile SASS mixin with the ability to utilize both optional and variable parameters

Is it possible to include both optional and variable elements in a sass mixin? I have attempted the following: @mixin name($className, $centered: false, $dimension...) however, the first dimension value is wrongly assigned to $centered. Switching the ...

Creating an image slider that pauses on mouse hover

Here is a code snippet that I'd like to share <body> <div id="slideshow"> <div> <img src="assets/images/home-banner.jpg" width="995" height="421" alt=""/> </div> <div&g ...

Using Angular to apply multiple ngClass directives

When dealing with 2 classes, I am only interested in enabling or using them if a specific condition is met: dealDispositionFormFields.isSubtenantTakingFullSpace === 'No' How can we create the correct syntax utilizing ngClass for this purpose? Th ...

How can we make the border-bottom for all list items (connection) function effectively?

After creating an unsorted list with list items, here is how it appears: <ul id="mylist"> <li> <input type="checkbox" id="[[Array]]" /> <label for="[[Array]]"><img src="images/[[ArrayImage]]"/></label> <div cl ...

Tips for choosing an option from a react dropdown using Cypress

Exploring Cypress: I am currently working with the following code snippet. Although it seems to be functioning, I have a feeling that there might be a more efficient way to achieve the desired result. There are 25 similar dropdowns like this one on the pag ...

Overlay a div on top of an image in an HTML email

To display text over an image in HTML email, I am looking for a solution since using margin or position is not working as required. Below is the code snippet I have tried: <div style="padding-right:25px;padding-left:20px"> <div style="padding-t ...

Arranging form elements and a map in a side-by-side layout using HTML5

How can I align the contents of a map and a form side by side with responsive design? I've attempted using tables and lists, but the form keeps appearing on top of the map. Ideally, I want the contents to be displayed side by side on wider screens and ...

Can you identify the attribute used for marking up an HTML code tag?

While examining a website's code to understand how they styled a specific section of their page, I came across the following snippet: <code markup="tt"> I thoroughly checked for any other references to this particular markup attribute ...

The jQuery function is not functioning correctly

Currently, I am in the process of setting up an accordion menu using jQuery and CSS3. Everything is working perfectly fine so far except that the menu always opens upon page load and the code to hide it is not functioning as intended. Here's the link ...

Tips for positioning an HTML element in the center with a border that aligns perfectly with its

Here's a little challenge for you: I have an HTML title with borders on the top and bottom. Can I center it so that the borders are the same width as the element? Currently, I'm forced to use a workaround involving setting the width, which is far ...

Is there a way to eliminate a div and all its contents from the DOM?

As I work on my web application, I am trying to implement a system where error messages can be returned via ajax upon success or failure. The ajax script is functioning correctly in terms of returning errors or successes. However, my challenge lies in com ...

steps to embed an image in a button using asp

Hey everyone! Can anyone tell me the best way to insert an image into a button in asp.net? <asp:Button ID="Login" runat="server" Height="27px" OnClick="Login_Click" Text="Log In " Width="92px" EnableTheming="True" /> ...

Is it possible to create a French flag using only CSS within one div?

What is the semantically correct way to display the French flag using only HTML and CSS? <div id="flag"> <h1>French flag</h1> </div> To represent the French flag with pure CSS (33% blue, 33% white, 33% red), you can use the fo ...

Styling with CSS: Proper alignment of elements within a div container

I'm struggling with positioning three elements within a div. The left element needs to be on the left, the middle element centered, and the right element on the right. Here's what I have so far in my CSS: #left-element { margin-left: 9px; ...

The table is not displaying the CSS class as intended

I need to modify the behavior of a table so that upon clicking on a value, a specific class is set and the user is redirected to a particular page. The structure of the table is as follows: <?php // Determine the file name based on content type if( ...