I am using jquery-ui-1.8.20.min.js.
I have a hyperlink on the page and am trying to do the following but doesn't seem to work.
$('a').tooltip({
content: function () {
return 'This is a test';
}
});
Nothing shows up. What am I doing wrong.
The Tooltip widget was introduced in jQuery UI 1.9.0.
You have to upgrade to this release in order to use it.
Related
I just saw this link which is a great explanation by onabai, but i´m trying to also set a template for the temporary popup and i can´t make it work:
$(".k-grid-popup", grid.element).on("click", function () {
// Temporarily set editable to "popup"
grid.options.editable = "popup";
// Insert row
grid.addRow();
// Revert editable to inline
grid.options.editable = "inline";
});
How do you set the template of the popup?
Regards.
While you can access the grid options directly, any change to the options should be made using the setOptions method. This function will notify the grid of any options change and it will be able to make all the internal change the handle the event according the the new options.
$(".k-grid-popup", grid.element).on("click", function () {
grid.setOptions({editable: "popup"});
grid.addRow();
grid.setOptions({editable: "inline"});
});
I don't have any working example of your code so I can't tell if you need to change something else in your code.
I am new in using jquery. I am trying add in the simplemodal.js (Eirc Martin's simple modal) a function called 'jBox' that will take the data (ie link) and options and using ajax will load the content into the modal container. This way I want on my pages in several places easy call this function
jBox = function(address, options){
$.get(address, function(data) {
$.modal(data);
});
};
});
The code is working fine, but i would like to add a loading image before the content is fully loaded. There is a lots of similar posts about loader/ spinner in simplebox but none of the works for me.
I was trying following code
$('#test').load('<img src="loader.gif">').html(data);
$('#test').modal();
But, some way, it doesnt work for me. Any ideas what I am doing wrong? Thanks
I use the ajaxStart and ajaxStop events.
$("body").on({
ajaxStart: function() {
$(this).addClass("loading"); // so page knows it's in loading state
// .. your modal code
},
ajaxStop: function() {
$(this).removeClass("loading"); // not it loading state anymore
// .. What you should do if loading is done. (eg. hide modal)
}
});
In this case I set the body class to 'loading'. So you can do some magic in css if you like.
I tend to use it to disable forms as well.
body.loading div.some-class {
// your special style for during loading
}
I am having some issues with a jquery on function that works in all browsers except IE.
jquery code is as follows:
$('#FormIndustryId, #FormIndustries').on("change", function () {
if ($(this).val()) {
$.getJSON('/categories/list_categories/industry_id:' + $(this).val(),
function (cats) {
if (cats !== null) {
populateCategorySelect(cats);
}
});
}
});
From a front end point of view this can be tested here: http://www.beanclaim.com/ - there is a field with the label of industry selection which is the dropdown with #FormIndustries assigned to it, it should when an industry is selected update the second dropdown with the ajax content. Chrome, Firefox and Safari it works but it seems to do nothing in IE.
Any ideas what I am doing wrong? Thanks
It's because only in IE do you have this code execute:
// IF IE (BROWSER) USE jQUERY TO SET THE PLACEHOLDER
// -------------------------------------------------->
if ( $.browser.msie ) {
$("#TemplateName").placeholder();
$("#FormIndustries").placeholder();
}
But, that returns this JS error:
SCRIPT438: Object doesn't support property or method 'placeholder'
and stops your JS from executing properly. I don't know what placeholder is (and neither does IE :) ), but if you fix that, the page works just fine in IE.
Write the same exact function, but make a copy using:
$('#FormIndustryId, #FormIndustries').on("click", ...
I've got a datatable with pagination and I've got anchors with popovers generated for each row but popovers are only shown on first results page. While filtering results or moving to another results page, popovers don't appear.
I wonder if someone already had the same problem and what I can do to fix this issue.
An alternative to ditscheri 's solution is using fnDrawCallback:
"fnDrawCallback": function ( oSettings ) {
$(".js_popover").popover({ html:true });
// $("[data-toggle=popover]").popover({ html:true });
},
The DataTables Plugin destroys and rebuilds the DOM elements on filtering/sorting. You might get along with something like this:
var myTable = $('#myTable').dataTable();
/* Apply the popover using the API */
myTable.$("[id^=popover-]").popover();
Here's some documentation on it: http://www.datatables.net/release-datatables/examples/advanced_init/events_post_init.html
If it doesn't help, you might want to provide a basic example of you code.
(Bootstrap 4, DataTables 1.10.25)
In my situation popovers worked on the first page - but NOT subsequent pages (page number > 1).
For my application this code allowed popovers to work on subsequent pages:
const rows = $("#tbl").dataTable().fnGetNodes();
$(rows).find('[data-toggle="popover"]').popover({ html: true, trigger: 'hover', placement: 'bottom', content: function () { return $(this).data('content') ; } });
i want to apply jquery tooltip plugin from jQuery Tools website
(http://flowplayer.org/tools/tooltip/index.html) to some elements loaded by ajax in my page.
i know that delegate(0 and live() methods are used for applying events to ajax loaded elements but i don't know how i can apply a plugin to these kind of elements.
the code is:
$("#mytable img").tooltip({
// each trashcan image works as a trigger
tip: '#tooltip',
// custom positioning
position: 'center right',
// move tooltip a little bit to the right
offset: [0, 15],
// there is no delay when the mouse is moved away from the trigger
delay: 0
}).dynamic({ bottom: { direction: 'down', bounce: true } });
would someone help me?
thank you.
Apply the call to a hover function portion of your script like:
$("#mytable img").live('hover', function() {
//your function here
});
Alternatively you can use the script directly inside the ajax page you're loading in, in which case the script is directly in the same layer as the content.
You have to initialize the tooltip plugin on the new content on the success function of your ajax call.
it is solved now.i wrote it here:
jQuery Tooltip plugin error