This seems like a pretty natural use case to me, though I haven't been able to find anything on it:
Say I have a fixed-width div that is dynamically populated with some number. What's the best way to ensure that numbers with more digits take smaller font sizes such that they fit nicely into that fixed width? Is there some CSS property for this, or do I have to resort to Javascript hackage?
Facebook has a "Dom Placeholder" on their Password field when logging on. When I click on the input for the password, the placeholder disappears and allows me to type my password "masked".
Is this Javascript related and how would I go on replicating this script?
I correctly inserted a javascript file into the wordPress admin with :
wp_enqueue_script()
I know that the script is loading. I tested it with an alert().
I then found that I am unable to access the DOM. When I tried :
document.getElementsByTagName('body')[0].addEventListener('load', function() {});
This error was:
Uncaught TypeError: Cannot call method 'addEventListener' of undefined
This is the first time I have used 'settings api' or inserted scripts into the WordPress admin.
Assuming my conditions for building a RSS feed reader were I had to provide only a Javascript snippet. The RSS is cross domain and is only XML. What are my options and how can I implement them? thanks
I recently transferred a site to a new host. Reloaded everything, and the javascript that worked fine before is breaking at an element it can't find. $('#emailForm') is not defined.
Now, the #emailform isn't on the page, but it wasn't before either, and JS used to skip this and it would just work. Not sure why this is happening. Any clues?
Hello everybody,
When my website is in fullscreen mode (with IE8), the window.focus() javascript command doesn' work.
Do you have a fix for my problem?
I tried to put a window.blur() before, without success.
Thank you!
Nicolas
I have a piece of html/javascript written in jQuery at http://pastebin.com/MzMPjtvF
My issue is the divs with images in them will only show up until $('.platform').hide() is ran, to the point that those divs won't even show up in $('.platform'). I'm not sure if its a bug or my lack of knowledge of jQuery
I've tried a few different things but nothing really worked, basically i need to get the current location/url from the iframe, get the part i want and return it to the hash in the url. how can i do this in javascript?
I've been trying to teach myself JavaScript, and one thing I was reading on is the try/catch structure. Unfortunately, the tutorial doesn't provide much explanation on how it would be useful, just how to set it up. Can anyone offer some insight?
Was styling the checkboxes of my webpage with jquery using the tutorial here
But i realized that I could not do SelectAll checkbox that will select all the checkboxes in my list. It works in the backend (the checkboxes are selected) but it does not show in my page.
Added a demo to show my problem. May need to port to your system to test it out
Demo
what can I add to the jQuery Custom Radio-buttons and Checkbox javascript file in the to achieve the select all checkbox function
Thank you!
I've made a pdf form in Adobe Acrobat. Now I want to make a button that submits the form to a HTTP POST request. I have searched for about 4 hours, but I have not found an example to do this.
Here I read that it is possible to send the pdf form fields with a HTTP submission, but there's also no example given:
http://acrobatusers.com/tutorials/form-submit-e-mail-demystified
I'm looking for a JavaScript example that I can link to the submit button.
i have a set of hyperlinks with href = javascript:method('category1') and likewise category2 category3 ...
I want to select hyperlink with href containing category1 so i have written
jQuery(a[href*='category1']) but dont know why it also selects hyperlinks with category10 category11 category12 ... also
I understand that category1 is common in all of them but 'category1' should'nt be do i need to put ' with escape charaters.
I'm trying to get my Javascript code 100% JSLint clean.
I've got some JS code that I've lifted from elsewhere to create a UUID. That code has the following line:
s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1);
This line incites JSLint to generate two error messages:
1) Unexpected use of '&'
2) Unexpected use of '|'
I don't understand why -- I'd appreciate counsel regarding how to recode to eliminate the error message.
I'm using CSS 3 features like "rounded corner" or "shadow box".
IMHO These are fantastic features for people like me with no graphics knowledge. But, i've noticed, IE 7-8 not support CSS 3.
So i'm asking you: is there a way to "enable" some features maybe with some javascript functions to include in my html file ?
Thank you!
Hello,
I am newbie to jQuery, just trying to learn it since last couple of days. In my office, there are few experience JavaScript Developer and they work mainly with jQuery for all their needs and whenever I got and talk to them to get some better understanding of how jQuery works and first they say is that on $(document).(ready) you do this and on $(document).(ready) you do that.
So my main question is What is the $(document).(ready) and how does it really works ?
Any inputs would be highly appreciated.
I want to show and hide rows of a table based on the value of a select box and this works in Firefox but not IE:
<select onChange="javascript: toggle(this.value);">
<option value="cat0">category 0</option>
<option value="cat1">category 1</option>
</select>
<table>
<tr name="cat0">
<td>some stuff v</td>
<td>some stuff v</td>
</tr>
<tr name="cat0">
<td>some stuff d</td>
<td>some stuff d</td>
</tr>
<tr name="cat1">
<td>some stuff a</td>
<td>some stuff a</td>
</tr>
<tr name="cat1">
<td>some stuff b</td>
<td>some stuff b</td>
</tr>
</table>
<script type="text/javascript">
function toggle(category)
{
// turn everything off
for (var i = 0; i < 2; i++)
{
var cat = document.getElementsByName('cat' + i);
for (var j = 0; j < cat.length; j++)
cat[j].style.display = 'none';
}
// turn on category chosen
var cat = document.getElementsByName(category);
for (var i = 0; i < cat.length; i++)
cat[i].style.display = '';
}
// start by showing cat0
toggle('cat0');
</script>
For a little while now javascript has the "map" function to loop over arrays.
It appears possible to use it as a 'foreach' operator for example:
var arr = ['a','b','c']
var doubles = arr.map(function(val){
return val + val
})
Is this better or worse than saying
for(var i in arr){ ...
50/50: saves having to use the index but adds a callback; it doesn't seem very common so I hesitate to use it but still want to.
dynamictextareas.push({guideid:targeteditorID, guideitemtext : textareacontents });
alert( JSON.stringify(dynamictextareas) );
See anything wrong with this JSON2 javascript code?
For some reason this come is making a mess of things. I want to push:
<p>DDDDDD</p>
But instead it's pushing:
[{"guideid":"1","guideitemtext":"<p>\u000a\u0009u000au0009DDDDDD</p>\u000a"}]
Any ideas? Is there a better way I can build this JSON object?
Hi all,
I have written a file using html and javascript.
In that Vertical scrolling should be there, but i want to stop horizontal scrolling.
How can I do that?
Hi all,
I would like to create something similar as Gmail's contact manager.
I'm not very experienced with Javascript, I understand the basic concepts of AJAX and know my way around jQuery. But that is as far as it goes.
Book/blog recommendations are greatly appreciated.
Thanks!
Hi,
I want to implement a progress par using AJAX for a flash file.
Please see the demo here
http://www.freeplaynow.com/online-games/play/1729/park-my-plane.html
Tried to debug their page but the javascript is obfuscated and im not so good in js. Any ideas ?
Thanks
Hi,
what is the best way to create MVC architecture in jQuery?
Should I use jQuery.extend()?
jQuery.extend({
View: function(){}
});
...or jQuery Plugin?
(function($) {
$.fn.model = function() { return this; };
})(jQuery);
...or just objects in JavaScript?
var model = {}
var view = {}
var controller = {}
Thank you!