Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
below i have my fiddle which i want to change the text color when the radio button is selected. However i cant get it to work. at the moment it isnt firing at all and i cant get the div css to change.
$(".package-container").click(function () {
$(this).closest('.radio-group-row').find('.package-title').removeClass('highlight');
$(this).find('input:radio').prop('checked', true);
$(this).find('.package-title').addClass('highlight');
});
http://jsfiddle.net/46jGT/3/
EDIT
Thanks, it does work with the JSFiddle, but in my .net project i cant get this peice to work. i have jquery 1.9 referenced at the bottom on the master page with this code on the control page.
As mentioned in comments, you're missing the jquery library. Your code is working fine as it is once the library is added
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I have some jquery code which handles some click events but i've ran into a problem where its firing both click events ive tried binding/unbinding them but not worked as i wanted it to. I've created a simplified version of it for demo.
jQuery('.tabs').click(function(e){
jQuery(this).toggleClass('active');
});
// jQuery('close_slide').click(function()){
// jQuery(this).parent().parent().removeClass('active');
// });
// Not part of Original question.
// But fixing the typos as they wony cause mention issue.
// Credits: #Jonas W.
jQuery('.close_slide').click(function() {
jQuery(this).parent().parent().removeClass('active');
});
The close slide element is inside of tabs so when i click the close slide element it doesnt remove as expected/
Thanks
Just stop the events propagation:
jQuery('.close_slide').click(function(evt) {
evt.stopPropagation();
jQuery(this).parent().parent().removeClass('active');
});
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I'm attempting to associate a data value with a div created dynamically, however I have not been able to get this to work. I've tried looking around online but can't seem to adapt any examples to fit my problem. If anyone could help I would be very appreciative. The error I'm getting says that:
.data is not a function
If I try putting the $ operator in front control just passes right through my block of code and nothing happens.
var container = $("#container");
('<div class="orb"></div>').data(num).appendTo(container);
It works well:
var $container = $('#container');
$('<div class="orb"></div>').data('num', 123).appendTo($container);
console.log($('.orb').data('num'));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="container"></div>
What is your problem?
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm trying to build a slide down menu using JQuery. I thought I'd base it around this logic, that if the menu had the class activated then when it is clicked it should be closed. Otherwise it is not open so it should be open.
The code below is a basic version of what I'm trying to achieve, but for some reason it never gets into the clause. Every time I click the item the alert box saying "Close" comes up.
$('#openMenu').click(function(){
if($('#openMenu'.hasClass('activated'))){
alert('close');
$(this).removeClass('activated');
}else{
alert('open');
$(this).addClass('activated');
}
});
Can anyone see where I might be going wrong? I should point out that when the page loads the div does not have the class activated applied to it.
$('#openMenu').toggleClass("activated");
It seems like your syntax for checking the element's class has issues, it should look like this:
if($('#openMenu').hasClass('activated')){
Here is the working fiddle:
http://jsfiddle.net/dnsdrzym/2/
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have a link:
Manage Lists
I want to "click" this link using jquery or javascript. I've tried:
$("#panel2-2").click(function(){});
$("#panel2-2").trigger('click');
It doesn't work! How can I do a click like this using javascript?
You need to use the jQuery attribute equals selector.
Description: Selects elements that have the specified attribute with a value exactly equal to a certain value.
For your case, you would use something like this:
$( "a[href='#panel2-2']" ).click();
You need
$('[href="#panel2-2"]').trigger('click');
or
$('[href="#panel2-2"]').click();
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I replicated the example of this site:
http://jqueryui.com/tooltip/#default
Html:
<h3 title='this is the title of hello world'>hello world</h3>
JS:
$(document).ready(function() {
$(document).tooltip();
});
But it's still shows the regular tooltip only.
JSFiddle with added CSS resource:
http://jsfiddle.net/HjPtJ/
As you can read here http://api.jqueryui.com/tooltip/ the tooltip widget is added in jQuery UI version 1.9, the JSFiddle has jQuery UI 1.8 added.