Skip to content
Advertisement

Tag: jquery

How to get the button text through calling a method

I am working on this demo. Why am I not getting the text of the #add-point button? Answer You don’t have any “this” in your function. You either need to pass it to your function or execute your code in the on click function. The this is a really important feature to master when coding in JS. Reference: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this

How to write a simple hello world program in Javascript?

I’ve been looking all over the world. All I see is samples alerting hello world I don’t want to alert hello world. I want to print a simple website saying hello world. Does javascript have a print command? Here are typical samples on the web http://groups.engin.umd.umich.edu/CIS/course.des/cis400/javascript/hellow.html Answer In JS code you don’t ‘print’ to the screen. Instead you amend the

jQuery – Selecting the first in the first of a

I have the following markup: I’ve already hooked up a click event handler using jquery $(“.delete-btn”) the problem is that inside the click event handler I need the text of the first element (foo). I’m already getting the value I need with this call: but I feel it’s too verbose. Is there a better way to accomplish this? Answer I

Additional input fields when filling up previous

Im trying to add additional fields in case when my user has filled up one group of inputs. So the idea is that when he finishes filling up the last input in that group, another group of inputs for same kind of items collapses/appears under existing one. One group of items consists of three inputs. After filling up that one,

Listen for jQuery Event With Vanilla JS

So I am trying to determine whether its possible to listen for events added with jQuery using vanilla JS. I found this question: Listen to jQuery event without jQuery which definitely answers it for version 1 of jQuery. How about version 3 however? I have a fiddle that I have put together to test out, but I am unable to

Focusing on nested contenteditable element

So, I have two contenteditable divs nested inside of another: Here is Fiddle. When it is focused, nested should be focused but using console.log(document.activeElement); it shows that the top is focused and it doesn’t recognize the nested div. In a case where content is being edited, I need to recognize nested div element instead of the top element. How would

JQuery click event and toggleClass method

I created a simple lottery ticket and I made selector with toggle method. This is my code. The toggle functionality works fine but I want to add a limitation so that only 7 numbers can be chosen in one container. Is there a way to achieve this. Here is my JSBIN > http://jsbin.com/menawu/1/edit?js,output Answer You need to check if there

jquery get() does not return any response

I actually try to load a php script and get some return values. I tried the following code: http://www.w3schools.com/code/tryit.asp?filename=FA39VK30JU3U It does the GET request correctly as i can see with firebug. But it never shows me any response with the alert box. I have also tried the following code: This returns ERROR undefined code 0 I hope someone see the

Advertisement