displaying dojo tooltip on a disabled validation t

2019-08-19 04:20发布

问题:

How can I display dijit.tooltip on a validation text box , when the validation text box is disabled.

Currently <div dojoType="dijit.Tooltip" id = "SomeId" connectId="someId" label = "Hello" ></div>

But this only works for validation boxes that are enabled, how can I show this on disabled boxes.

回答1:

html part

 <span id="abcd">
 <input type="text" disabled="true" dojoType="dijit.form.ValidationTextBox" id="someId11" />
 </span>
 <div dojoType="dijit.Tooltip" connectId="someId11" jsId="tt1" label = "Hello" ></div>

JS PARt

<script>
 dojo.require("dijit.form.ValidationTextBox");
dojo.require("dijit.Tooltip");
dojo.require("dijit.TooltipDialog");
dojo.require("dojox.fx");

var dialog;

dojo.addOnLoad(function() {

dojo.connect(dijit.byId('someId11').domNode,'mouseenter', function(){
    console.log("HI")
    tt1.open(this)
})

dojo.connect(dojo.byId('abcd'),'mouseleave', function(e){       
    //e.preventDefault ();
    //e.stopPropagation ();
    tt1.close();        
    console.log("HI2")
    //return;

})


tt1.addTarget(dojo.query('input', dijit.byId('someId11').domNode))


回答2:

Try this

require(["dijit/Tooltip", "dojo/domReady!"], function(Tooltip){
       new Tooltip({
       connectId: ["TestButton"],
       label: "Tooltip for button"
    });
        new Tooltip({
    connectId: ["TestingTooltip"],
    label: "Testing the tooltip options in DOJO"
    });
 });
 dijit.Tooltip.defaultPosition = ["above"];

You can give HTML tags too in label.



标签: dojo tooltip