« first day (1495 days earlier)      last day (3460 days later) » 

10:00 AM
@SecondRikudo Wait doesn't that mean it'll get 'input' as TagName ?
 
@DavidH Not unless you actually type 'input'
 
This doesn't work for me, did I do something wrong? Paste being the id of the input.

var test = $('#paste').val();
var rectangle=document.getElementsByTagName(test)[0];
 
@RoelvanUden Thanks!
/**
 * handleArrays
 * Converts object like `{ 0: ..., 1: ..., 2: ... }` into `[..., ..., ...]`.
 *
 * @name handleArrays
 * @function
 * @param {Object} obj Object containing objects with numbers as keys.
 * @return {Object} The object with converted objects in arrays.
 */
function handleArrays(obj) {
    var convert = true;
    var keys = Object.keys(obj).map(function (key) {
        var val = parseInt(key, 10);
        if (isNaN(val)) {
            convert = false;
        }
        return val;
^- This is my final version
 
hwy 'hey
 
@DavidH the val() is a tag name?
 
10:02 AM
hey
 
@FlorianMargaine Well it is when I directly paste the <rect> in it right?
 
@DavidH No, it's not.
You are misunderstanding how getElementsByTagName work...
 
so document.getElementsByTagName('<rect>') will work according to you?
 
!!welcome AniketDeshmukh
 
10:03 AM
@AniketDeshmukh 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.
 
No document.getElementsByTagName('rect') will work
Although that's a good point..makes me realize why it's not working
 
@DavidH No, it won't.
 
@SecondRikudo it will, if the rect is in the dom
 
But it does for me @SecondRikudo
 
@CapricaSix ok sorry
 
10:04 AM
hello everyone, has anyone here ever use ddSlick plugin? need some help with it..
 
Yea if it's in the body of course
 
Because you want to paste the element's source code, not to get it from DOM
 
@SecondRikudo actually it looks like he does...
 
Yea but to answer Florian that is, of course in the input it wouldn't work I've realized @SecondRikudo jsfiddle.net/ug7y6451 Leave the input be since it doesn't work, just press the button and you'll see what I've done as well
So you guys do know what I try to do now?
 
10:06 AM
Well have you seen it work with the polygon and rectangle in the body?
 
@FlorianMargaine I think I understood.
He wants to paste a <rect> or a <polygon> source code, do some manipulation on it (like rounding the points), and the spitting out the source code after everything is done.
 
What I want now is to instead of making my function work when it's in the body, to make it work when it's in the input
@SecondRikudo I've always not been the best in explaining but that's exactly what I mean
It's just my lack of experience in Js and knowledge as to not knowing exactly how to get correctly
 
@SecondRikudo ah
 
@DavidH In that case, I would put whatever they put in the input into the dom (with document.getElementById('fixture').innerHTML = input.value), use the same function on that injected element, and then read the source with generatedElement.outerHTML.
This is making a lot of assumptions though
For example, that only one element is pasted into the input
That they don't paste elements with IDs colliding with elements already there on the page
 
is there any way to bind data with li element ?
 
10:10 AM
etc.
 
so that whenever i click on that element, i can access that data
 
Oh yea I was planning to have two inputs for each shape.
Also removing the shapes from the body of course
 
ASR
 
That is if I get this to work of course but I guess i'll look up what you meant because i'm not getting the idea yet
 
!!tell SweetWisherツ jquery data
 
10:12 AM
@SweetWisherツ api.jquery.com/data
 
@SecondRikudo Also what element is 'fixture' in your example ?
 
@DavidH Could be anything.
 
o/
 
@FlorianMargaine can it be attached with li too ?
 
10:13 AM
Usually a div with display: none
 
I am bit new with jquey
 
@SweetWisherツ It can be attached to any element in the DOM.
 
Oh awesome! I was actually going to try that before I asked here because I thought it could be done easier
 
@SecondRikudo I am adding li dyncamically
 
Then I guess I get the idea!
 
10:14 AM
@SweetWisherツ So?
Please read the page @CapricaSix linked to you.
Read it thoroughly and understand it.
 
yes....referring
 
Oh also @SecondRikudo, $('#inputId').val(); is fine too right? Or is it better to not get Jquery mixed up? To use in the innerHTML that is
 
Experienced users, could you please have a look at this ?
@dystroy then how does the alert display correct item? I mean if the loop has already been executed then item = the last element; but it starts displaying all the elements from the start to the end? also if its too long and you did not read it completely then you should not have closed the question. because the question you marked duplicate does not answer any of my questions. — Syed Farjad Zia Zaidi 6 mins ago
User is disputing my closing
 
@DavidH I don't see why you need jQuery at all in this example.
To get an input's value?
 
Yea I guess it's a bad habit but I usually do it with jquery
Since it's included anyway
 
10:20 AM
@DavidH Then stop :P
Just because it's included doesn't mean you should be using it for everything.
 
Yea that's why I asked I want to learn to do it the right way >.<
 
It would only make it harder to get rid of once you want to.
 
Yea that's true
 
@dystroy you want the 200k goodies?
 
@FlorianMargaine Na, I want the 100k ones
 
10:22 AM
@dystroy you should send a mail to SE requesting the goodies
"I DEMAND the goodies!"
 
Might not produce the expected result
 
Yeah but they might just condemn you and then all the other players will think you're not trustworthy.
Then SE might declare war on you .. :/
Wait is this real life?
 
I have set data : jsfiddle.net/fu9e9/336 how can I get it back on click event ?
 
@FlorianMargaine not me :P
 
10:29 AM
@FlorianMargaine dat gif
Ping it to rlemon he'll be stuck for hours
 
ASR
0
Q: How to check whether the entered mobile is landline or mobile using PhoneFormat.js?

ASRThis is my example form I just have take one text box, where i will enter mobile number and i will choose the country from the drop-box menu, for validating the mobile number with country I have used the http://www.phoneformat.com/ here they have given one method isValidNumber(phno, country) whic...

 
any idea ?
 
@SecondRikudo Thank you so much!!! That really helped, fixed it !
 
10:50 AM
Although I have one small issue, it works perfectly fine but after starting the function(click the button) the two Hidden elements holding the information turn into: [object HTMLUnknownElement]. Is there a check to prevent this from showing?
I've been searching around but haven't been able to find a solution for it
 
@SweetWisherツ are u a girl ?
:O wow
 
@darkyen00 That's a lie. There are no girls on the internet.
 
O_o
@SecondRikudo lolzz
 
@SweetWisherツ exactly @SecondRikudo
 
is it correct way to set data ? jsfiddle.net/fu9e9/342
 
10:52 AM
. If it TRULY is a girl, then this is an INCEPTION!!! Only way out is to die, so look at Chuck Norris the wrong way.
 
@darkyen00 then your question is TOTALLY invalid
 
@SweetWisherツ just kidding :-)
no offence.
 
@darkyen00 That's so 1990.
 
@Unihedron +1
 
no offense.
 
10:54 AM
@SecondRikudo Did you have any idea how to prevent that? I can't really imagine why either, all it does is hold information.
 
@Unihedron i remembered an incidence from the past ... when i saw that name
 
@Unihedron You weren't... in 1990 :P
 
@SecondRikudo The internet is full of girls...
 
@SecondRikudo :( I can pretend to be, though. As a ninja.
 
@AwalGarg you are from the good part of history of web.
 
10:54 AM
@AwalGarg All girls on the internet are obese old men until proven otherwise.
 
hey @uni, you can help me :)
 
we knew how it felt to be out-cast of society; back in the days when geeks were considered "weird"
 
@SweetWisherツ What's the issue?
 
i want to bind data with li
tried this http://jsfiddle.net/fu9e9/342/
not sure it is correct or not :/
but ultimately I want to get data when I click on li button
 
@darkyen00 And nerds. Can't forget them...
 
10:55 AM
now geeks is the new cool.
 
@darkyen00 they are still, atleast the real ones.
 
nerds are still weird, no change there.
 
:(
 
@darkyen00 noep ;p
 
@SweetWisherツ jQuery :(
 
10:56 AM
@Unihedron hmmm..why ??
 
I don't know jQuery, only vanilla-JS, sorry
 
;-;
 
I second that
 
find some jQ guy then
 
10:56 AM
@SweetWisherツ would u like to explain what you are trying to achieve
 
@SweetWisherツ No
 
this room can give u much better solutions
for your case.
 
You want this data ^
 
but we can't read code and magically understand what is supposed to happen off it.
 
10:57 AM
@Unihedron Nope
 
@darkyen00 @Zirak can
 
@SecondRikudo fixed
 
@SecondRikudo yope
;p
 
@SecondRikudo did you read her mind :?
 
@darkyen00 yes.. I want to sync the data on click of li button.. I have no idea how can I bind model data with li element so that I can work on it wheenver click event is fired on button
 
10:58 AM
Yeah then use the .data method
i'd just give an attribute to the li
and use a hashmap to manage that.
but i am weird.
 
HashMap? Hashmaps in Javascript? Aren't they from Java? :D
 
how to add data to button in list ?
 
@Unihedron php brotha!
 
........ oh.
 
10:59 AM
data-data = data
 
Well... doesn't know PHP either. I totally do not qualify as a web developer.
 
did I set data correctly or not ?
the list items are appended in loop
 
@Unihedron c
 
@darkyen00 can you show me in fiddle ?
 
$.data(e))
what :o
 
11:02 AM
hold on wtf is wrong with that code!
 
why are there double spaces everywhere in html strings?
 
I read jQuery.data( element )
so tried e
 
hey listen
jQuery's data
works only
 
and spaces before tag endings?
 
11:03 AM
with data added via jQuery i guess
 
@AwalGarg in js ?
 
and returns?
 
Anyone? >.< Is there a check for [object HTMLUnknownElement] ? Or a way to prevent/hide it?
 
yeah that
 
I've tried typeof to see if it's an object but that doesn't help
 
11:03 AM
does it make any difference ?
 
it makes it ugly
 
is there any way to format code in fiddle?
 
'hard coded string' + 'another hardcoded string' wtf?
 
i copied it from ma project..that's why
 
is that some jQuery requirement?
 
11:05 AM
Does anyone happen to know of a way to prevent showing a template in angular before binding occurs? On a somewhat slower phone I'll first be presented with the {{data}} bindings and whatnot, prior to it being filled. I'm using ngRoute for route navigation and templates and such.
 
@RoelvanUden ng-bind
 
nothing can beautify that thing because you put everything in a string. And no code would like to meddle with your strings...
 
@AwalGarg javascript doesn't has multi line strings
 
@darkyen00 What? Can you elaborate?
 
that code is era old solution
 
11:06 AM
WRONG!
 
@FlorianMargaine \ is a hack
 
@darkyen00 she is not making multiline strings... her code is analogous to alert('hello' + ' ' + 'world');
and a > is outside the bracket which is a syntax error ofc...
 
i did it jsfiddle.net/fu9e9/347 but a small problem
 
meh this is point three of benjamins topic discussions
 
346th revision of a fiddle? :O
 
11:10 AM
is it ok now ?
:O
@AwalGarg 347 now
 
why pass the event variable if you are not using it?
 
can I ask mongodb problems here? @_@
 
@ChandlerLee 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.
 
@AwalGarg will remove it.
 
ok.
@SweetWisherツ now... what exactly do you want that code to do?
 
11:12 AM
but you can see I have set data as button = $( "button" )[0];
i want to set data for all button in li as I said before li is added in loop
 
first, there is no loop. Second, I am not sure if that is the correct way to add li elements.
 
Am I correct to say that if : [object HTMLUnknownElement] shows it means the browser thinks the element is not a valid or holds an invalid html element?
 
to set data, are you talking about jQuery data sets or html5 data sets?
 
jQuery
 
!!jquery data
 
11:15 AM
 
how can I set json data ?
 
el.data('key', jsonData);
 
$.data(el, json); does the same ?
 
I don't think so. Use the first one, since that is what the docs say.
 
while trying your way I am getting error as
"Uncaught TypeError: Object #<HTMLButtonElement> has no method 'data'"
 
11:23 AM
> Note: This is a low-level method; a more convenient .data() is also available.
from that page
 
@dystroy @Shog9 said swag is coming but it's taking time.
 
I wrote like $( "button" ).data('d', "test");
@AwalGarg ohk..but what about error
 
@BenjaminGruenbaum thanks !
 
fiddle
it is working for me, you must have some other code causing the problem
 
let me check
I am using backbone.js.. can it be a cause?
 
11:27 AM
@dystroy no space :(
 
might be
 
Ya solved that error... but not able to get data back
 
jquery non conflict mode
 
set as : $("button").data('d', "test");
and getting as : $.data(this)
is it correct way ?
 
no!
 
11:28 AM
because I m getting {}
 
use el.data('d');
 
ok wait
but what is el in click event O_o
 
e.target
 
so for you, it would be
SPOILER: `$(e.target).data('d')`
 
11:31 AM
@FlorianMargaine You mean "no space:(", right ?
 
@AwalGarg yehaaaaaaaaaaa :)))))))))))))))) thankuuuuu
 
...you need to pay me now
 
hw much O_O
 
$1000 + 100% service tax
 
11:32 AM
+200% service tax tax
 
:P
 
please define this policy here :P
 
cc @rlemon ^^^^
 
cc @rlemon :P
jQuery needs better documentation :/
 
11:34 AM
jQuery needs to go
 
A brick weighs a kilo and a half a brick. How much does yo mamma weigh?
 
@SweetWisherツ jsfiddle.net/bvqqoe1z/1 a 2 minute work... without jq. Do you think your jquery code is cleaner or better than this?
this is why @Unihedron gave you that link
 
@SweetWisherツ My advice would be to stop using jQuery altogether.
 
^
!!afk abstract classes in php rox!
 
I even dont want to work with js, i love JAVA :)))))))
 
11:38 AM
WAT!!!!
 
Aside from that text animation thing which couldn't be accomplished by vanilla-JS in under 5 minutes, jQuery virtually doesn't bring any advantages.
 
@SweetWisherツ A real programmer should know every popular language out there.
 
afk for real
 
!!afk my work here is done, lurking
 
11:39 AM
@Unihedron I know but dont like :P
 
@Unihedron that's false.
 
@BenjaminGruenbaum Unihedron is afk: my work here is done, lurking
 
@SweetWisherツ go work with Java then.
 

« first day (1495 days earlier)      last day (3460 days later) »