Skip to main content

All Questions

Tagged with
0 votes
1 answer
18 views

Active class for single class element jQuery

I have these buttons which are actually p elements in a grid and they all have the same class. I would like to change the color of the p element which the user clicks on. How can I add an active class ...
shimmyshimmyya7347's user avatar
0 votes
2 answers
30 views

Change background color for separate divs on focusout depending on current text input

Been thinking about this for many hours now but can't come up with a solution. I have about 5 divs with the same class: <div contenteditable="true" class="change"> When I click on a div, the ...
jokr1's user avatar
  • 77
23 votes
1 answer
8k views

$(this) is selecting window object instead of clicked element jquery [duplicate]

I have a really strange issue. I simply want to select a clicked element. I did this a lot of times and it always worked but this time, the jQuery $(this) selector doesn't select the clicked element, ...
Rurpot's user avatar
  • 259
0 votes
3 answers
38 views

How to get a specific child of the $(this) selector (out of two children)?

I have already tried each of the solutions from: How to get the children of the $(this) selector? I have two buttons, one for Friday and one for Saturday. I want to only show the spinner icon on the ...
Spencer Shattuck's user avatar
1 vote
1 answer
65 views

Jquery $('class', this) selector doesn't work

Hello I'm quite new with jquery and I can't get something to work. I'm trying to transform a div with a .click function: JQUERY $(document).ready(function(){ $('#show').click(function(){ $('....
Daren Smit's user avatar
-2 votes
1 answer
42 views

Selecting text of child div

I have following scenario like on the pictures below I edited task with text 'task1' Changed text to 'task2' New text 'task2' appeared on the screen. However I have problem to get edited text and ...
Andrew_Dublin's user avatar
3 votes
2 answers
5k views

Get current element on click

I have two divs with same class pan-detail-div and have a span tag. When user clicks on that span tag,I want to get that div. For example if user clicks span of left side div, It should return only ...
Huma Ali's user avatar
  • 1,779
0 votes
2 answers
92 views

Can't get (this) jQuery selector working

I have a repeating class called "a.add_mycrate" on my page. This script targets the clicked instance (this) only and deals with it. Here is my JS : jQuery(document).ready(function(){ jQuery(document)...
Grant's user avatar
  • 1,327
1 vote
3 answers
2k views

jQuery $(this) selector is not working within a function

I'm trying to make a function that will be fired with the 'onclick' event of a procedurally added div.hb-menu-subMenuToggle element. The function works when using the initial selector as anything but '...
user avatar
0 votes
2 answers
77 views

Select all except $(this)

I have the following bit of code $('.radio-box').click(function() { $(this).parents('.container-radio-box').find('.select').removeClass('state-active'); } and I'm trying to get it so that it ...
user avatar
0 votes
2 answers
34 views

Not Sure About What $(this) points to here

Just a quick question about using $(this) in JQUery. If you have something like: $('li.biz').mouseover(function(){ $(this).find('a.invisB').slideDown(); }); what will $(this) select? Does it ...
Oloff Biermann's user avatar
6 votes
5 answers
76 views

How to pass $(this) to selector

I have a jquery click handler which toggles one of list elements: $(document).on('click', 'ul li', function() { $(this).toggleClass('expanded'); }); With it I can change element I clicked ...
s.webbandit's user avatar
  • 16.7k
3 votes
3 answers
661 views

Using the this keyword with jQuery selectors

Can someone please help me with the syntax of using the jQuery this keyword? Here is my code that works: var obj = jQuery.parseJSON(data); $('.example_infobox1').addClass(obj.gridlayout); $('....
Simon's user avatar
  • 8,279
19 votes
1 answer
57k views

jQuery: "$(this).next().next()" works, but "$(this).next('.div')" does not

Okay, I am trying to get this set of information to hide individually. This works: $(".arrow").click(function() { $(this).next().next().slideToggle(); }); <img class="arrow" src="https://via....
fjaxyu's user avatar
  • 390
0 votes
1 answer
41 views

How do I use $(this) to reuse a particular selector in the condition

How do I use $(this) to reuse a particular instance of the $('select').data('field') only if it is equal to a particular value in the condition. if ($('select').data('field') === "DriverDiscovery....
Joseph Campbell's user avatar

15 30 50 per page
1
2 3 4 5