JavaScript - Using Jquery .show(); With A Var As The Class
I'm trying to get a div that is contained within another div to show using jQuery. Basically something like
Code: jQuery(document).ready(function(){ $('.outerdiv .innerdiv').show(); }); The only problem is that the first div class isn't always the same, it depends on the URL. I have already set it up so that a var is defined based on the URL, but what I am having trouble with is using that in the show() command. So let's say my var is called "name". I would want to be able to write something sorta like $('.[name] .innerdiv').show(); so that, if the value of the var is (for instance) "jack", it would be as if I wrote $('.jack .innerdiv').show(); but I can't figure out how to properly reference the var within those quote marks. Any help? Similar TutorialsHi all Just curious how I might be able to target an anchor class with jQuery. For example, If my anchor class is: #nav a.activeSlide { } How can I target it for a fadeTo() ? Not sure of the syntax. Tried variations of: $('#nav a.activeSlide').fadeTo(1000,.5); To no avail. Thanks for your help. Hey All - I asked this a few days ago.. what I came up with works just fine, but I feel it doesn't take advantage of "classes". If you think I could make this better by turning it into a class or using some other notation, that would be great. Keep in mind, ALL this does is rewrite a pagination.... for a search return in a lightbox. I have this function called in the return function... Code: var srcpagParams = $H(); function buildPagi(param, currdsplyNum){ var temDsply = new Template('<strong>[#{total_display}<span id="count">#{prevImg} #{links} #{nextImg}</span>'), crnt_link = srcpagParams.set('crnt_link', param), // the page we want to see dsplyNum = srcpagParams.get('paginateNum'), // what is the number of returns per page ttl_lnks = Math.ceil( srcpagParams.get('numFound') / srcpagParams.get('paginateNum')), // total pages data_template = new Hash(); data_template.set('total_display',srcpagParams.get('numFound')); bldImg = function() { var prvB = '<a href="#content" id="pagiPrev" onclick="firesrc(this)">Prev<img src="blank.gif" /></a>'; var nxtB = '<a href="#content" id="pagiNext" onclick="firesrc(this)">Next<img src="blank.gif" /></a>'; data_template.set('prvImg',(crnt_link > 1) ? prvB : ""); data_template.set('nxtImg',(crnt_link < ttl_lnks) ? nxtB : ""); } bldLk = function(){ var holder = ""; if(ttl_lnks > 1){ var linkStr = new Template(' <a href="#content" onclick="firesrc(#{pos});"> Go to page #{pos}</a> '); $R(1,ttl_lnks).each(function(n) { var posit = {pos : n} holder += (crnt_link == n) ? " " + n + " " : linkStr.evaluate(posit); }); data_template.set('links',linkholder); } } bldRng = function(){ var currPaneRg = (dsplyNum * crnt_link) - (dsplyNum - currdsplyNum); data_template.set('range',((crnt_link - 1) * (dsplyNum) + 1 ) + " - " + currPaneRg); $('pages').update(temDsply.evaluate(data_template)).show(); } firesrc = function(cl){ var pagiPane = (typeof cl === "number") ? cl : (cl.id == "pagiNext") ? crnt_link + 1 : crnt_link - 1; var start = crnt_link * srcpagParams.get('paginateNum'); Alertsrc( $F('query') ,(pagiPane)) // pass the query to the json to return the current search request } bldImg(); buildLnk(); bldRng(); }; Since some of the data declared at the top changes depending on the return, I didn't know if I could "initialize" it in a class. But could I turn this into a class and if so - what I just use: var buildPagi = create.Class({ initialize: object.extend({ }) }) Call the function when we are passed some data: Code: buildPagi(somevalue, somevalue2) ** NOTE: I use the libraries prototype and jquery.. so use Create.Class and new Template are within the libraries... etc.. so, is there a more eloquent, or robust way to write what I did above? Hi Guys! I found one great solution for show/hide JQuery but i can't figure out how to make JS,css and html code all together, so please if anybody can make that code together for me and post me here! -Thanks in advance!!! here is code with example: http://jsfiddle.net/9XmVT/14/ Hello all, I'm still learning java. I have the concept of hide/show down, but want I want to do is when a div is shown, all the other divs are hidden, and when I click on another div to show, the other one hides, etc. This is my code for jquery show/hide: Code: <script type="text/javascript"> $(document).ready(function(){ $('#{field_label}').hide(); $('input#show{field_label}').click(function(){ $('#{field_label}').show('fast'); }); $('input#close{field_label}').click(function(){ $('#{field_label}').hide('fast'); }) }); </script> What do I need to add so that the previous DIV that was open, auto closes when a NEW DIV is enabled to show. Much appreciated Coders! hi! i am doing a site using jquery address deep linking and within the content i need to implement a show/hide div function but it doesn't seems to be working. jquery address source: http://www.asual.com/jquery/address/ demo: http://www.asual.com/jquery/address/...tabs/#Overview my show/hide div: <a href="javascript:toggle('clickHere','here' true)">click here</a> <div id="here" style="visibility:hidden; display:none">xxxx</div> function toggle(target,imgname, isOn){ window.onresize = null; obj=document.getElementById(target); obj2=document.getElementById(imgname); if(isOn){ obj.style.visibility='hidden'; obj.style.display='none'; obj2.style.visibility='visible'; obj2.style.display='inline'; } else{ obj.style.visibility='visible'; obj.style.display='inline'; obj2.style.visibility='hidden'; obj2.style.display='none'; } } * the same set of show/hide codes work when the site is not implemented with jquery address (deep linking) * so what could be the issue here? please help! can any guys help me to fine the jquery based slide show right to left with next previous and auto facilities on div not on ul li based?
Hi, im trying to get the errors of an upload form validation displayed in a div. PHP Code: <div id="error_div" class=""></div> Here is the javascript: PHP Code: <script type="text/javascript" language="javascript"> function validateForm(){ var flag = true; if (document.uploadForm.user_file.value == ""){ alert('No file selected.'); flag = false; } if(flag == true){ if(document.uploadForm.user_file.value.slice(-4) != ".mp3"){ alert('File extension must be mp3 only'); flag = false; } } return flag; } </script> Instead of showing the errors with an alert, i want to show them on the div and at the same time changing its class atribute to Alert, wich is a class i defined on my css page. Mybe with this? PHP Code: document.getElementById(error_div).className='Alert'; Any ideas are welcome, thanks in advance Hi Friends, I am come with a new query in jQuery. I have a listing form in which the details showed , the View more Details is implemented using Ajax. When Click "+" sign there is a loading image show First then the Result show there ... It's all working Fine , But I need a way to show Error I mean some time Server Response is success with Empty String on that time I need to catch same .... I explain code Below: Code: if(proceed) { $.ajax({ type: "POST", data: "key="+id, dataType: 'json', async: true, url: "<?php echo site_url(); ?>/server/view_serverdet/", beforeSend: function() { $('#view_load'+id).show(); $('#view_load'+id).addClass(class); }, complete: function(){ $('#view_load'+id).hide(); } }, success: function (server_msg) { if (null == server_msg) { var warning = "<font color=\"red\">Unable to load server details</font>"; $('#view_load'+id).html(warning); } else { // Working Fine! } But that error Just Show and Hide ... How I can show that Error there, If you have any idea , pls help me ASAP... Thankfully Anes P.A Hello, I have a complex website designed with Jquerry, javaScript and css. The index.html serves as a client ui for an open source poker game. Much of the css is contained in multiple and imported external css files. The javaScript code is also contained in an external file. The site is completely functional. What I am attempting to do is add a feature to the client that will, through a JavaScript function, dynamically change the visibility element of a class. The classes in question represent the style of the hole cards that a player sees after his cards are dealt. By default they are visible and face up. I would like to change this default behaviour by first changing their visibility element default value to hidden (easy). Then I intend to create a div with onMouseOver and onMouseOut events that will invoke the JavaScript function which will toggle the visibility element value. This will in turn show and hide the hole cards (not easy). I have attempted to use document.getElementById() but without success. After much hacking, I have the feeling that this is not the proper way of directly changing the visibility element value of a class. Here is the relevant class info (how the cards are displayed in the browser) in the external css file Code: .jpoker_table .jpoker_ptable_card_seat00 { width:191px; height:262px; visibility:hidden; z-index:2; position:absolute; top:140px; left:10px; -webkit-transform: scale(1); -moz-transform: scale(1);background-image:url("images/jpoker_table/cards/small-back.png");} .jpoker_table .jpoker_ptable_card_seat01 { width:191px; height:262px; z-index:3; position:absolute; top:190px; left:60px; -webkit-transform: scale(1);-moz-transform: scale(1); background-image:url("images/jpoker_table/cards/small-back.png");} Left alone these classes will display within the contentWrapper div in the browser as the hole cards which are visible and face up. Here is the relevant html associated with the above classes. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript"> //<![CDATA[ var version = {title: "TiddlyWiki", major: 2, minor: 3, revision: 0, date: new Date("Dec 4, 2007"), extensions: {}}; //]]> </script> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <!--PRE-HEAD-START--> <!--{{{--> <link rel="alternate" type="application/rss+xml" title="RSS" href="index.xml"/> <link href="css/jpoker_seat0.css" rel="stylesheet" type="text/css" /> <!--}}}--> <!--PRE-HEAD-END--> <title> TiddlyWiki - a reusable non-linear personal web notebook </title> <style type="text/css"> #saveTest {display:none;} #messageArea {display:none;} #copyright {display:none;} #storeArea {display:none;} #storeArea div {padding:0.5em; margin:1em 0em 0em 0em; border-color:#fff #666 #444 #ddd; border-style:solid; border-width:2px; overflow:auto;} #shadowArea {display:none;} #javascriptWarning {width:100%; text-align:center; font-weight:bold; background-color:#dd1100; color:#fff; padding:1em 0em;} #peek .jpoker_table .jpoker_action, .jpoker_table .jpoker_action {position:absolute; width:243px; height:54px; top:72px; left:10px; visibility:visible;} </style> <!--POST-HEAD-START--> <!--POST-HEAD-END--> <script type="text/javascript"> </script> </head> <body onload="main();" onunload="if(window.checkUnsavedChanges) checkUnsavedChanges(); if(window.scrubNodes) scrubNodes(document.body);"> <!--PRE-BODY-START--> <!--PRE-BODY-END--> <div id="copyright"> Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association </div> <noscript> <div id="javascriptWarning">This page requires JavaScript to function properly.<br /><br />If you are using Microsoft Internet Explorer you may need to click on the yellow bar above and select 'Allow Blocked Content'. You must then click 'Yes' on the following security warning.</div> </noscript> <div id="saveTest"></div> <div id="backstageCloak"></div> <div id="backstageButton"></div> <div id="backstageArea"><div id="backstageToolbar"></div></div> <div id="backstage"> <div id="backstagePanel"></div> </div> <div id="contentWrapper"> <div id="peek"> </div> </div> <div id="contentStash"></div> <div id="shadowArea"> <div title="MarkupPreHead"> <pre><!--{{{--> <link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/> <!--}}}--></pre> </div> I have added the following Jquery code to the external jquery.javascript.js file in my web directory. In the middle is the //showholecards code that I added. I pasted the surrounding code to give an example of the existing code within the file. Code: // // muck (table plugin helper) // jpoker.plugins.muck = { AUTO_MUCK_WIN: 1, AUTO_MUCK_LOSE: 2, templates : { muck_accept: '<div class=\'jpoker_muck jpoker_muck_accept\'><a href=\'javascript://\'>{muck_accept_label}</a></div>', muck_deny: '<div class=\'jpoker_muck jpoker_muck_deny\'><a href=\'javascript://\'>{muck_deny_label}</a></div>', auto_muck: '<div class=\'jpoker_auto_muck\'><div class=\'jpoker_auto_muck_win\'><input type=\'checkbox\' name=\'auto_muck_win\' id=\'auto_muck_win{id}\'></input><label for=\'auto_muck_win{id}\' title=\'{auto_muck_win_title}\'>{auto_muck_win_label}</label></div><div class=\'jpoker_auto_muck_lose\'><input type=\'checkbox\' name=\'auto_muck_lose\' id=\'auto_muck_lose{id}\'></input><label for=\'auto_muck_lose{id}\' title=\'{auto_muck_lose_title}\'>{auto_muck_lose_label}</label></div></div>' }, muckRequest: function(server, packet, id) { if ($.inArray(server.serial, packet.muckable_serials) != -1) { $('#muck_accept' + id).show(); $('#muck_deny' + id).show(); } }, muckRequestTimeout: function(id) { $('#muck_accept' + id).hide(); $('#muck_deny' + id).hide(); }, sendAutoMuck: function(server, game_id, id) { var auto_muck = 0; if ($('#auto_muck_win' + id).is(':checked')) { auto_muck |= jpoker.plugins.muck.AUTO_MUCK_WIN; } if ($('#auto_muck_lose' + id).is(':checked')) { auto_muck |= jpoker.plugins.muck.AUTO_MUCK_LOSE; } server.sendPacket({type: 'PacketPokerAutoMuck', serial: server.serial, game_id: game_id, auto_muck: auto_muck}); server.preferences.extend({auto_muck_win: $('#auto_muck_win' + id).is(':checked'), auto_muck_lose: $('#auto_muck_lose' + id).is(':checked')}); } }; // // showholecards // $("peek").hover( function () { //on hover $("#jpoker_ptable_card_seat00").show(); }, function () { //on hover out $("#jpoker_ptable_card_seat00").hide(); } ); // // cards (table plugin helper) // jpoker.plugins.cards = { update: function(cards, prefix, id) { jpoker.plugins.cards.update_value(cards, prefix, id); jpoker.plugins.cards.update_visibility(cards, prefix, id); }, update_value: function(cards, prefix, id) { for(var i = 0; i < cards.length; i++) { var card = cards[i]; var element = $('#' + prefix + i + id); element.removeClass().addClass('jpoker_card jpoker_ptable_' + prefix + i); if(card !== null) { var card_image = 'back'; if(card != 255) { card_image = jpoker.cards.card2string[card & 0x3F]; } element.addClass('jpoker_card_' + card_image); } } }, update_visibility: function(cards, prefix, id) { for(var i = 0; i < cards.length; i++) { var card = cards[i]; var element = $('#' + prefix + i + id); if(card !== null) { element.show(); } else { element.hide(); } } } }; I have found a jQuery slide show at http://tobia.github.com/CrossSlide/ which interests me because of its smooth, cross-browser fade transitions. I would like to add a feature which automatically resizes the images proportionally, to fit the browser window. This feature is demonstrated in the Supersized slide show at www.mauitradewinds.com, but I am not satisfied with the quality of fade transition with Supersized -- especially under Safari. I would appreciate any guidance as to how to implement auto-resizing with the Cross-slide plug-in. Additionally, it would help if Cross-slide launched the slide show without waiting for all images to load.
So, i have this code which retrieves php files for me using jquery and id love to get it working with Jquery history plugin. I tried modifying the code i got from the ajax demo to work for me, but i just couldnt do it as i do not know any javascript really.. ( actually what i tried was simply to change "#ajax-links a" to "#menu li a" and .html to .php ..but nothing.. :rolleyes: Id be very gratefull if someone would help me out with this one. All related code can be found bellow (the ones that should be needed anyways): This is the code that retrieves php files inside "#content" when item from "#menu li a" with the specified id is clicked Code: $(document).ready(function(){ //References var change = $("#menu li a"); var loading = $("#loading"); var content = $("#content"); //Manage click events change.click(function(){ //show the loading bar showLoading(); //load selected section if(this.id == "home") { change.load(this.className='current-page'); content.slideUp(); content.load("pages/index.php", hideLoading); content.slideDown(); } else if(this.id == "secondpage") { change.load(this.className='current-page'); content.slideUp(); content.load("pages/secondpage.php", hideLoading); content.slideDown(); } else { //hide loading bar if there is no selected section hideLoading(); } }); //show loading bar function showLoading(){ loading .css({visibility:"visible"}) .css({opacity:"1"}) .css({display:"block"}) ; } //hide loading bar function hideLoading(){ loading.fadeTo(1000, 0); }; }); Heres the structure of the menu/content Code: <ul id="menu"> <li><a id="home" class="normal" href="#Home"></a></li> <li><a id="secondpage" class="normal" href="#Secondpage"></a></li> </ul> <div id="content"> <ul id="sec-menu"> <li><a id="link1" class="normal" href="#">Link1</a></li> <li><a id="link2" class="normal" href="#">Link2</a></li> </ul> </div> Heres the code that jquery history plugin uses in demo for ajax Code: jQuery(document).ready(function($) { function load(num) { $('#content').load(num +".html"); } $.history.init(function(url) { load(url == "" ? "1" : url); }); $('#ajax-links a').live('click', function(e) { var url = $(this).attr('href'); url = url.replace(/^.*#/, ''); $.history.load(url); return false; }); }); hi, i have a jquery problem... this script is not working with jquery-1.4.2.min, but it works with jquery-1.2.6.min.js, can anyone help me???the script is the above: (it is not working the tab actions, the slideout works...) http://www.benjaminsterling.com/wp-c...es/sidetab.htm the javascript code is the above: PHP Code: var jqsideTabs; var tabs, h = 50, r = 0,ra = 0; $(document) .ready(function(){ jqsideTabs = $('#sideTabs').addClass('closed'); tabs = jqsideTabs .find('.tab h3') .clone() .appendTo(jqsideTabs) .each(function(i){ var that = $(this), cls = '',ow,newThis, newEl; if( i == 0 ) cls = ' active'; newEl = $('<a href="#" class="tabLinks'+cls+'">' + that.text() + '</a>'); that.replaceWith(newEl); ow = newEl.outerWidth(); if( i == 0 ) ra = ow; else r = ow; h = newEl.css({'top':h , 'right': -ow }).height() + h; newThis = newEl.get(0); newThis.jq = newEl; newThis.i = i; newEl.click(function(){ var el = this.jq; if( jqsideTabs.hasClass( 'closed' ) ){ jqsideTabs.removeClass('closed'); } else if( !jqsideTabs.hasClass( 'closed' ) && el.hasClass('active') ){ jqsideTabs.addClass('closed'); } el .siblings() .removeClass('active') .css({'right': -r }) .end() .addClass('active') .css({'right': -ra }); tabs.eq( this.i ).show().siblings('.tab').hide(); return false; }); }) .end() .parent() .eq(0) .addClass('active') .end() .filter(':not(:eq(0))') .hide() .end(); jqsideTabs.bind("mouseleave",function(){ jqsideTabs .animate({left:-310}, 'fast', function(){ jqsideTabs.addClass('closed').removeAttr('style'); }); }); }); and the html file is: [HTML] <div id="sideTabs"> <div class="tab"> <h3>Tab 1</h3> <div class="gut"> <p>Some text</p> </div> </div> <div class="tab"> <h3>Tab 2</h3> <div class="gut"> <ul> <li>link</li> </ul> </div> </div> <div class="tab"> <h3>Tab 3</h3> <div class="gut"> <ul> <li>link</li> </ul> </div> </div> </div> [/HTML] the problem is that the tab button works, but the content doesnt change...in all of tabs showing the same text(showing all tbas content).... can anyone help...please..... i keep getting the error GET http://code.jquery.com/jquery.min.map net::ERR_TOO_MANY_REDIRECTS & Failed to load resource: net::ERR_TOO_MANY_REDIRECTS when i load my page...and the havascript doesn't work properly on ym page...how do i resolve this. thanx in advance Hello, I am new with Javascript and running into this problem that I don't understand. I define a base class that only contains an array "elements", and a derived class that contains nothing more (for simplicity): Code: function baseClass() { this.elements = new Array; } function derivedClass() { } derivedClass.prototype = new baseClass; Then I create two instances of the derived class, and add two elements in each: Code: a = new derivedClass(); a.elements.push("A"); a.elements.push("B"); b = new derivedClass(); b.elements.push("C"); b.elements.push("D"); When I examine the contents of these arrays, I see that both a.elements and b.elements contain {"A","B","C","D"} ! I.e. as if the two arrays are in fact the same array! But these are two separate instances of the class, I expect two separate arrays. Note that if instead I use the base class: Code: a = new baseClass(); a.elements.push("A"); a.elements.push("B"); b = new baseClass(); b.elements.push("C"); b.elements.push("D"); then I get a.elements = {"A","B"} and b.elements = {"C","D"}, as I would expect. Could someone explain to me the problem with using the derived class? Thank you, Stephanos var s="attr" var i=$(s) // jQuery(elem).attr(attr,eval("elm"+attr)); jQuery(elem).$(s)(attr,eval("elm"+attr));//i tried this. how to assign a variable name in the above code(in place of s) so that i need to add an attribute to the element "elem". How do I show the default icon for pdf, doc, etc... else show the image? Code: Show the default icon for pdf, doc, etc... else show image. Default icon: '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' + The image: '<img alt="" src="' + fileUrl.replace( /'/g, '\\\'') + '" height="36" border="0"></a>' + Attempted javascript onError but only certain browsers support that or it's my code. Code: '<img alt="" src="' + fileUrl.replace( /'/g, '\\\'') + '" height="36" border="0" onerror="this.src=images/icons/' + sIcon + '.gif"></a>' + Any ideas? Ok, I would post my entire data here but then yall would be reading insane amounts of script. I've got a div content jquery slider on my site I am making and it works beautifully in all browsers(took me a while). Then, I decided why not have it where when people click on a "read more" link that it pops up a box, instead of directing to the new page, and displays the contents of a div. It would not work at all. My question is there a possible way to do this?
I'm not sure if this is something jquery can do or what but here's what I want to do but I have this following code and when it shows either Public or Archived for the Event Status I want it to be a link so that if I click on Public then it turn it into Archived because it'll change its status_id in the DB from 4 to 5. PHP Code: case 1: echo $e; ?> <h1 class=backstage>Archiving Management</h1><br /> <h2 class=backstage>Weekly Events</h2><br /> <?php $query = "SELECT ecb.bookingdate, els.name, ele.statusname, ecb.label FROM `efed_content_booking` AS ecb LEFT JOIN `efed_list_shownames` AS els ON ( ecb.event_id = els.id ) LEFT JOIN `efed_list_eventstatus` AS ele ON ( ecb.status_id = ele.id ) WHERE els.type = 'singular' OR els.type = 'recurring'"; $result = mysql_query ( $query ); $rows = mysql_num_rows($result); if ($rows > 0) { print'<table width="100%" class="table1"> <tr class="rowheading"> <td>Event</td> <td align="center">Booking Date</td> <td align="center">Event Status</td> </tr>'; $i = 0; while ( $row = mysql_fetch_array($result, MYSQL_ASSOC) ) { $sClass = 'row2'; if ($i++ % 2) $sClass = 'row1'; printf ( "<tr class=\"%s\">", $sClass ); printf ( "<td valign=\"top\">%s%s</td>", $row['name'],$row['label'] ); printf ( "<td valign=\"top\" align=\"center\">%s</td>", convertdate($row['bookingdate'] )); printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row['statusname'] ); echo '</tr>'; } echo '</table><br>'; } else { echo '<span>There are no weekly events to archive.</span><br /><br />'; } ?> <h2 class=backstage>Pay-Per-View Events</h2><br /> <?php $query = "SELECT ecb.bookingdate, els.name, ele.statusname, ecb.label FROM `efed_content_booking` AS ecb LEFT JOIN `efed_list_shownames` AS els ON ( ecb.event_id = els.id ) LEFT JOIN `efed_list_eventstatus` AS ele ON ( ecb.status_id = ele.id ) WHERE els.type = 'ppv'"; $result = mysql_query ( $query ); $rows = mysql_num_rows($result); if ($rows > 0) { print'<table width="100%" class="table1"> <tr class="rowheading"> <td>Event</td> <td align="center">Booking Date</td> <td align="center">Event Status</td> </tr>'; $i = 0; while ( $row = mysql_fetch_array($result, MYSQL_ASSOC) ) { $sClass = 'row2'; if ($i++ % 2) $sClass = 'row1'; printf ( "<tr class=\"%s\">", $sClass ); printf ( "<td valign=\"top\">%s%s</td>", $row['name'],$row['label'] ); printf ( "<td valign=\"top\" align=\"center\">%s</td>", convertdate($row['bookingdate']) ); printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row['statusname'] ); echo '</tr>'; } echo '</table><br>'; } else { echo '<span>There are no ppv events to archive.</span><br /><br />'; } returnmain(); footercode(); break; All, I have the following jQuery code: Code: $("#other").click(function(){ var checked = $(this).is(':checked'); if(checked){ $('textarea#other_text').removeAttr("disabled"); }else { $('textarea#other_text').attr("disabled", "disabled"); } }); This works fine. However, what I'm allowing the users to do is edit this field. So I have the following PHP code: PHP Code: <input type="checkbox" name="other" value="x" id="other" <?php if($resultsetedits['other']=="x"){ echo "checked"; } ?>> Other:<br>If you choose other, please explain what other options you'd like us to do to your photo:<textarea name="other_text" rows="3" cols="119" id="other_text" disabled><?php if($resultsetedits['instructions']!=""){ echo $resultsetedits['instructions']; } ?></textarea> Since the checkbox is checked with the PHP code the click function to jQuery never gets invoked and my textarea remains disabled. Is there anyway to basically invoke the jQuery code with my PHP script? Thanks in advance. |