$("#id").val().length to count the characters in a phone field... How can I get it to ignore the following, "(" and ")" and "_" and "spaces" jQuery mask is causing problems. I need to enable a button only after 10 digits are entered. It's giving me a count of 14 every time :(
Ooo... Found this .replace(/\D/g,"").length will try it
Mostly, when you see programmers, they aren’t doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they’re sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. [Charles M. Strauss]
People need to get a sense of humor, if you don't have one, the internet is the wrong place for you.
@phenomnomnominal Just curious, but using just base JS and not jQuery, am I really cripplin my cross-browser capabilities if I don't know the exact differences?
Or is it really only for doing really high-tech stuff that you need to worry about cross-browser issues
I like jQuery, it's easier and fun to write, I was just doing vanilla for learning purposes, but I'm pretty sure I have the hang of it now so I think I'm just making things harder on myself by refusing not to (like writing node without express)
I have one last question, I'm loading multiple a-links and I need a way to identify them separately, so I did data-id='#{info._id}', and was going to go getElementsByAttribute, but then I find that I guess that is a jQuery method, how might I assign event listeners to all of them, this was my attempt:
what causes a function to be considered undefined if the function you call is not inside any other function ? its not making any sense why i get the error
@JanDvorak
var element = document.getElementsByName('deleteNews');
for(var i = 0; i < element.length; i += 1) {
element[i].addEventListener('click', function(e) {
markAsReadDatabase(this.getAttribute('data-value'));
e.preventDefault();
});
}
'<p class=\'muted credit\'> ' -- alternating quote types helps you reduce the amount of escaping neccessary
concerning that innerHTML, you could create an h2 separately, and set its textContent. If you want to be extra-clean, create a text node and append it to the h2.
@JohnLandis Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
> The setTimeout() method must run the following steps:
> 1) Let handle be a user-agent-defined integer that is greater than zero that will identify the timeout to be set by this call in the list of active timers.
...
> 6) Return handle, and then continue running this algorithm asynchronously.
clearTimeout on non-timeout is legal, but I wasn't sure
> If handle does not identify an entry in the list of active timers of the WindowTimers object on which the method was invoked, the method does nothing.
I think node.js does timers differently (Which is allowed of course since it's a different spec, no window and all). setTimeout in node.js returns an objects, which has an integer valueOf
I'm currently working on a node.js app and I'm having the ususal asynchronous code issue.
For learning purposes I'm implementing an http server over node's tcp module.
This server supports (express like) routes.
For example I have code that looks like this:
server.any("/someRoute",function(r...
Beauty is more important in computing than anywhere else in technology because software is so complicated. Beauty is the ultimate defence against complexity. [David Gelernter]
Thanks, it's not about the return value of setTimeout, it's about timeouts having to be considerably more complicated in node.js since they're bound to a domain and not globally
They run inside a domain, and only propagate outwards if not handled on the domain level, kinda like DOM events in JavaScript
@Nexxpresso Thing is, they're just words he made up. For different sites, that he probably won't link to his identity here, he must have used other words he made up
For a WordPress login form I have written a small plugin. It adds a checkbox with a unique name to the form and if that name is not present in the login POST request it just dies.
The idea is preventing scripted attacks made for regular WordPress login forms.
The PHP code is okay (imho), but I ...
It works, but randomally it doesn't load about one every 4 times
It's probably crossrider's fault (we use them for cross-browser development, safari wasn't a development goal initially). I'd like to know if I can solve it myself though
Not really, there are many places to mess up building something that complicated, our application is thousands of lines of JavaScript, loaded dynamically and has to stay synced through a 3rd party API which is thousands of lines on its own
@Jan Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.