Skip to content
Advertisement

Tag: jquery

How can one use JS to add a draggable field?

What do I need to change in my code so that it generates draggable fields. This is what I have tried so far: The code currently generates the fields but they are not draggable while being clicked. Answer You’re trying to set ‘draggable’ on the elements before they exist. Try setting it (and your click handler) after you insert them

Return object using classnames and switch statement

So I have an object build out that has a bunch of methods inside, I want to be able to narrow down some methods and see if there are other ways to do thing, so I will go into more description below: So I have the following method which returns me a bunch of class names: Now I have another

Clicking images to pass the names in a URL string

I have a low level knowledge of javascript and am trying to create a basic image based quiz that passes data back to a search page for local businesses. Each image would have it’s own “tag” as the image ID that relates to one of the options in the search. Ie. Outdoor, Ballroom, Barn, Garden, etc. Upon submission, it would

getting the height of the text in a fixed height div

Say I have this code: With a font-size of 150px it’s none to surprising that the text inside the div would be bigger than the div itself. At least in Google Chrome it is. My question is… how might I go about figuring out the height / width of the text within a fixed size div? Using jQquery, $(…).height() returns

Create new dynamic id in javascript

I have this piece of code right here that creates somewhat of a grid (but not really) of chocolate pieces in x and y positions (height and length) depending on what the user chooses in the input, and i want it to assign a new id (preferably imgPos1, imgPos2 etc…) to each piece of chocolate it produces individually. I have

Generalization of JQuery submit function

In my web application I have dozen of forms, of course each one with a different id. Then in my JavaScript file I wrote a custom handler for the submit event: I want to avoid to write the above code for each form. As first step I can just wrap it in another function, something like this: and then use:

owl-carousel not working in mobile device

responsive property doesn’t seem to have an effect. In desktop version it is working fine, but on mobile device it still shows the same number of items as in desktop. Answer Just in case, maybe you did not include responsive meta tag: <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> Seems to be working fine with the code you added, maybe some css that

Select filter hides all the items in the list

I am trying to create a select dropdown filter which dynamically gets its values and data from rest api. Here is my code HTML JS But for some reason it hides all the items and nothing change after changing the options I want to initially load all the items and then filter based on the option I want the select

Advertisement