Datatables YADCF - input focus on load - javascript

I'm using the excellent Datatables with Vedmack's YADCF plugin, which is working great. The only thing I can't figure out is ...
How do I switch focus to a specific YADCF filter text input box on page load? I've tried the following in and outside of document.ready, but neither work:
$('#yadcf-filter--Table-7').ready(function() {
$('#yadcf-filter--Table-7').focus();
});
... and ...
$('#yadcf-filter--Table-7').load(function() {
$('#yadcf-filter--Table-7').focus();
});
The input box doesn't appear for about 2 seconds after page load and the ID is appended by the plugin, which I assume is why I'm struggling to get it to work.
Any ideas, please?
Thanks!

Sorry - ignore this, the following works fine, I'd just made a daft mistake earlier on:
$(document).ready(function() {
yadcf.init(Table, [
etc, etc...
];
$('#yadcf-filter--Table-7').ready(function() {
$('#yadcf-filter--Table-7').focus();
});
});

Related

Really Live Preview with TinyMCE (value of TinyMCE)

I'm using a short Jquery Script to make a live preview of a few input fields. Now with TinyMCE i can't get the value of tinyMCE to insert it into a div. I found another thread Get value of tinymce textarea with jquery selector, but i not really can figure out how to use this tipps on my code. I'm a beginner with jQuery and very thankful vor every help.
JS Fiddle
$(document).ready(function() {
updatePreview();
$('#live-preview-form input, #live-preview-form textarea').bind('blur keyup',updatePreview);
});
function updatePreview(){
var tinymce = $('#lp-message');
tinymce.html($('#message').val());
}
Sorry, but there are lot of mistakes in Your code. :/
This is the only code that you need under javascript section.
tinymce.init({
selector: "textarea",
setup : function(ed) {
ed.on("keyup", function(){
$('#lp-message').html(tinymce.activeEditor.getContent());
});
}
});
And here is your html code:
<div id="live-preview-form">
<textarea id="message">Easy! You should check out MoxifvdfvdfvfdveManager!</textarea></div>
<div id="lp-message"></div>
As u can see you have to use tinymce API to get content from editors. And "keyup" events should be used on editor not on the "textarea".
I hope that I helped You. :)

Have simple wordpress jquery script not working

Ok so i have a simple jquery script im trying to load into wordpress i have other scripts already working but for some reason this one is not working. I have it working just on a simple html page but right when i put in wordpress.
Could someone help me and let me know why i keep getting unknown syntax error
jQuery(document).ready(function ($) {
jQuery(".comb-7").hover(function () {
$(this).find('.background-hover').toggle();
}
});
thanks for any help
This cant Work, you're missing the cloosing the bracket for the hover method
You don't close the hover method. Should be:
jQuery(document).ready(function($) {
$(".comb-7").hover(
function () { $(this).find('.background-hover').toggle(); });
});

jQuery On Not working for simple script

There must be some mental block that I'm just not getting...My entire site is working fine, but dynamically created links with an ID are not. Something is wrong in my code...it's as simple as this but it's not working, please show me my dumb mistake (I know it's something simple).
so for example this would be a generated link:
Hi
and then I have this script:
$(document).ready(function() {
$(document).on('click','#himan',function(){
alert('hi');
});
});
but nothing happens, and I get no errors...I'm lost, maybe my coffee is not working today. Can someone help me?
Here is demo
It is working perfect:
$(document).ready(function () {
$(document).on('click', '#himan', function () {
alert('hi');
});
});
reason might be duplicate of id, there must only one element with specific id because id is a unique on a page, if you adding multiple element use class instead of id.
Handle the click event on #himan itself...
function initializeDynamicLinks() {
$('#himan').on('click',function(){
alert('hi');
});
}
$(document).ready(function() {
initializeDynamicLinks()
});
Here you see it working: http://jsfiddle.net/digitalextremist/emUWL/
Rerun initializeDynamicLinks() whenever you add links dynamically.
And... as has been pointed out several times in comments, you need to make sure #himan only occurs once in your source to be completely sure everything will function properly.

I want to have a overlay using css but it's not working

I am trying to create a overlay dialog box using CSS . I wrote the css but I am not able to display the overlay dialog box. Any help would be greatly appreciated.
Check out my attempt here. Also this should work in IE9 and firefox.
http://jsfiddle.net/tGDKT
why not just use jQuery UI's dialog:
http://jsfiddle.net/maniator/tGDKT/15/
$(function() {
$('.clickme').click(function() {
$('iframe').dialog();
});
});
You could also attach the method in the javascript, unobtrusive style. Give the <a> an id or:
$('a').click(calculateEmbeddedWindowSize);
... would call the function for every link on the page.
I keep getting "calculateEmbeddedWindowSize is not defined" in the console. Your javascript does not seem to be there at all on the page.
Edit - Try this: http://jsfiddle.net/tGDKT/7/

Jquery Masked Input plugin not working within FancyBox(Lightbox)

I'm using the jQuery Masked Input Plugin from here: Digital Bush
I'm also using the jQuery FancyBox plugin.
As far as I can tell, they don't play nice together.
My masked inputs do not work if in the FancyBox, though they work outside (same id #phone). FancyBox displays fine.
The fancy box is on the page, display: none at page load....so I attempted to use the callbackOnShow setting, but id does not want to work.
JAVASCRIPT:The alert function won't fire
$(document).ready(function() {
loadScroll();
$("a.inline").fancybox({
'callbackOnShow' : function(){alert('shown');}
});
});
Found it, callbackOnShow should be onComplete.
$(document).ready(function() {
loadScroll();
$("a.inline").fancybox({
'onComplete' : function(){alert('shown');}
});
})
Found here: fanbcyBox/Blog

Categories

Resources