attr

How to target image with certain src path with JQuery

How would I go about targeting the below img with the src file? <img src="left1.gif" alt="" /> $('img[src=left1.gif]').hide(); doesn't work ...

jquery string to function convert

is this possible? <div id="anything">I will change</div> <div id="id" jq="$('#anything').css({background: 'red'})"></div> var x = '$('#id').attr('jq')'; jQuery.call(x); Basically i would like use an attribute jq on any tag to act like a onclick would on html that calls the javascript statements. btw jQuery.call() is for demonstratio...

Extracting numbers from the parent attribute in jQuery

By clicking on the "mylink" I want the link to be replaced by the number "123", which is extracted from parent tag. I think I'm not doing the ".match(...." right. jQuery: $(document).ready(function(){ $(".link").click(function(){ var comid = $(this).parents("div.comment").attr("class").match(/comment-([0-9]+)/)[1]; $(".link")...

IE6 not changing attributes (id and name) with jQuery attr call - any suggestions?

Suggestions other that dumping IE6 that is... I can't control that :) Quick synopsis of what I am trying to do: I have a form with select elements. When the user selects a specific option in the select (id type2 in the code below), I display a div structure that contains a new select. I want the new div structure and its children to be ...

finding clicked id deep in document using jquery

I'm going to use the text from the jquery example, For example, consider the HTML: <lots of divs to get to here> <div id="#targetid_0"> Click here </div> <div id="#targetid_1"> Trigger the handler </div> I have a series of questions that are plaguing me... Assuming that I click on 'Click Here' or 'Trigger the Handler': If I'm ...

Setting EventLog Name (source) using attribute on calling class with Log4Net

I'm using Log4Net - with a little wrapper around it - kind of similar to this: http://stackoverflow.com/questions/166438/what-would-a-log4net-wrapper-class-look-like What I want to be able to do, is specify the Source in the windows event log (using EventLogAppender) Example: [EventLogName("My Little Test Program")] class Program { ...

jQuery element with multiple classes: storing one class as a var

I'm trying to create a standardized show/hide element system, like so: <div class="opener popup_1">Click Me</div> <div class="popup popup_1">I'm usually hidden</div> Clicking on the div with the opener class should show() the div with the popup class. I don't know how many opener/popup combinations I'm going to have on any given page,...

Get the parent id..

I have a bunch of elements like the following: <div class="droppableP" id="s-NSW" style="width:78px; height:63px; position: absolute; top: 223px; left: 532px;"> <div class="sensible"></div> </div> They all have class droppableP but different id's obviously and I would like to factor the code in this script I am hack...

YouTube API, jQuery attr won't swap element attributes (I think) in IE, but works in FF

JavaScript (jQuery) function display_youtube(new_url) { $('#movie_url').removeAttr('value'); $('#embed_url').removeAttr('src'); $(document).ready(function() { $('#movie_url').attr('value', new_url); $('#embed_url').attr('src', new_url); $('#shade').css('display', 'block'); $('#youtube_player')...

Can this be converted to work with multiple (20+) instances?

I'm using this code for a faq. You click on the img and it opens the box, clicking on the img also closes the box. The img switches on each click. So far I have not been able to convert this to work with more than 1 section. I know nothing about jquery or javascript, but understand some programming concepts. I have been trying for 4...

how to get option title="sample" using jquery

Hi, I'm trying to update a hidden field based on the a title attribute on a select option, I've tried the code bellow and can't seem to get it to work. Thanks for any help! <form> <select id="selectbox"> <option name="test" value="one" title="title" selected="selected">one</option> <option name="test2" value="two" title="title2">two</op...

jquery delay() doesn't delay attr() in the queue

hi, what is wrong in this code? I'm trying to get this effect: fadeOut(500) and attr('class','myClass') delayed by 600 millisecs.. then delay(600) again, and fadeIn(500). The delays happen correctly but the attr() is not being delayed, it fires when #myDiv is still fading! :'( $('#myDiv').fadeOut(500).delay(600).attr('class','myClass'...

jQuery: select checkbox when upload field is clicked

I'm working on a CMS. When a user wants to replace an existing thumbnail image, they can upload a replacement, and check a checkbox to certify that they are indeed replacing the image. The checkbox seems necessary because otherwise the form submits a blank value (due to the blank default value of the upload field, a security default for ...

JQUERY: When I remove a attr, I can't add the attr again

This is my code: $("input[name=donationmode]").change(function() { $(".setpaymentOptions").children().addClass("fadeout"); $(".setpaymentOptions").children().children(".inputfield").children("input").attr("disabled", "disabled"); $(".option-"+$(this).val()).removeClass("fadeout"); $(".option-"+$(this).val()).children("....

jquery .attr() problems

I wrote this quick tooltip function for my links: $(function() { $('a').hover(function(e) { var title = $(this).attr('title'); $('<div id="tooltip">' + title + '</div>').css({"top" : e.pageY + 12, "left" : e.pageX + 12}).appendTo('body'); }, function() { $('#tooltip').remove(); }); $('a').mousemove(function(e){ ...

Jquery style checking and finding the element.

Hello! In my script i'm looking for the DIV which has class .se and has style attribute display: block, and i need the DIV's ID. My method is wrong :( var usedse = $(".se"):has(css('display', 'block')).attr("id"); Could you help me please to fix this? ...

jquery's attr function works only one time

I use this snippet to show a dialog. This works great however: the title is going to be set only for the first time I click the table cell. After reloading the page again the title is set - for one time. Ad infinitum... $(document).ready(function() { $("td[id^='_ctl0_tbl_content_reportid_']").click(function() { var tokens = ...

Updating attr("onclick") issue

Hi, I have the next code to work on ASP.Net controls. I'm trying to add some javascript code to "onclick" event on a button when the result variable(res) is equals to "NO". The issue is that the first time it assigns the value to "onclick" it works fine, but when the removeAttr is executed and again the function is call and the res is ...

Jquery attr function does not work in IE7.

Hey All I am using jQuery 1.3.2, It seems the attr function does work in IE8 and FF 3 but not in IE7. The problematic code: .attr("disabled",true) or .attr("disabled","disabled") Is there an alternative way to disable an element? (a specific option in a SELECT element) Thank you. ...

jQuery: ahref title from underlying img alt

I'm using this to open outgoing links in a new window, but when the target is an image, I want to display the image alt as the title. $("a[href*='http://']:not([href*='"+location.hostname+"']), [href*='https://']:not([href*='"+location.hostname+"'])") .addClass("external") .attr("target","_blank") ...