[jQuery] Re: How do I extract a part of received data
Thanks for your reply Rodrigo. On Sep 21, 10:57 am, Rodrigo Sebastián Alfonso wrote: > let's say you have "World" in data, you have to do this: > > $("div").find("p").html($("div").find("p").html() + data); > > so your html would look like: > > HelloWorld > > > > On Mon, Sep 21, 2009 at 11:49 AM, Frederik wrote: > > > Anyone has any idea ? > > > I have tried this way. > > $("Hello").find("p").appendTo("#content"); // > > works... it append Hello > > > I have tried it with all the content of data parameter > > $(data).appendTo("#content"); //works - add all the DOM received in > > Data > > > The problem is when I try to extract a part of data, it does not work > > $(data).find("p").appendTo("#content"); // Does not find the Hello > p> part > > > Thanks in advance for your help > > > On Sep 18, 10:34 am, Frederik wrote: > > > Wrong syntax? Please explain. > > > > I try to use this instruction found onhttp://www.visualjquery.com/: > > > jQuery(expression, context) > > > > > The core functionality of jQuery centers around this function. > > Everything in jQuery is based upon this, or uses this in some way. The most > > basic use of this function is to pass in an expression (usually consisting > > of CSS), which then finds all matching elements. > > > > > By default, if no context is specified, $() looks for DOM elements > > within the context of the current HTML document. If you do specify a > > context, such as a DOM element or jQuery object, the expression will be > > matched against the contents of that context > > > > > Example > > > > > Finds all div elements within an XML document from an AJAX response. > > > > jQuery Code > > > > > $("div", xml.responseXML); > > > > Please do not tell me this is because this is for XML data only. I > > > read Ajax request may return HTML data and will process it as well. > > > In fact, I already use $get() (an AJAX calling function) that return > > > HTML. > > > > On Sep 18, 8:07 am, lanxiazhi wrote: > > > > > this : > > > > var elem = $('#section_news', data); > > > > is not the right syntax. > > -- > Rodrigo Alfonso
[jQuery] Re: How do I extract a part of received data
Anyone has any idea ? I have tried this way. $("Hello").find("p").appendTo("#content"); // works... it append Hello I have tried it with all the content of data parameter $(data).appendTo("#content"); //works - add all the DOM received in Data The problem is when I try to extract a part of data, it does not work $(data).find("p").appendTo("#content"); // Does not find the Hello part Thanks in advance for your help On Sep 18, 10:34 am, Frederik wrote: > Wrong syntax? Please explain. > > I try to use this instruction found onhttp://www.visualjquery.com/: > jQuery(expression, context) > > > The core functionality of jQuery centers around this function. Everything > > in jQuery is based upon this, or uses this in some way. The most basic use > > of this function is to pass in an expression (usually consisting of CSS), > > which then finds all matching elements. > > > By default, if no context is specified, $() looks for DOM elements within > > the context of the current HTML document. If you do specify a context, such > > as a DOM element or jQuery object, the expression will be matched against > > the contents of that context > > > Example > > > Finds all div elements within an XML document from an AJAX response. > > jQuery Code > > > $("div", xml.responseXML); > > Please do not tell me this is because this is for XML data only. I > read Ajax request may return HTML data and will process it as well. > In fact, I already use $get() (an AJAX calling function) that return > HTML. > > On Sep 18, 8:07 am, lanxiazhi wrote: > > > this : > > var elem = $('#section_news', data); > > is not the right syntax.
[jQuery] Re: How do I extract a part of received data
Wrong syntax? Please explain. I try to use this instruction found on http://www.visualjquery.com/: jQuery(expression, context) > The core functionality of jQuery centers around this function. Everything in > jQuery is based upon this, or uses this in some way. The most basic use of > this function is to pass in an expression (usually consisting of CSS), which > then finds all matching elements. > > By default, if no context is specified, $() looks for DOM elements within the > context of the current HTML document. If you do specify a context, such as a > DOM element or jQuery object, the expression will be matched against the > contents of that context > > Example > > Finds all div elements within an XML document from an AJAX response. > jQuery Code > > $("div", xml.responseXML); Please do not tell me this is because this is for XML data only. I read Ajax request may return HTML data and will process it as well. In fact, I already use $get() (an AJAX calling function) that return HTML. On Sep 18, 8:07 am, lanxiazhi wrote: > this : > var elem = $('#section_news', data); > is not the right syntax.
[jQuery] How do I extract a part of received data
I explain... I try to load only a part of my data file (named Elements.html). It will load all the data file with var elem = $('#section_news', data); Here is my code $.get("Elements.html", function(data){ // get id section_news for the receive data var elem = $('#section_news', data); $('#content').empty().append(elem); }); My host html My Elements.html data file Hello World!Hello Fred!
[jQuery] How do I extract a part of received data
I explain... I try to load only a part of my data file (named Elements.html). It will load all the data file with var elem = $(data); I am unable to load only a section of this file if I use var elem = $('#section_news', data); Could you please help me find out what part of my code is incorrect? Thanks Here is my code $.get("Elements.html", function(data){ // get id section_news for the receive data var elem = $('#section_news', data); $('#content').empty().append(elem); }); My host html My Elements.html data file Hello World!Hello Fred!
[jQuery] How do I extract a part of received data
I explain... I try to load only a part of my data file (named Elements.html). It will load all the data file with var elem = $('#section_news', data); I am unable to load only a section of this file if I use var elem = $('#section_news', data); Could you please help me find out what part of my code is incorrect? Thanks Here is my code $.get("Elements.html", function(data){ // get id section_news for the receive data var elem = $('#section_news', data); $('#content').empty().append(elem); }); My host html My Elements.html data file Hello World!Hello Fred!
[jQuery] IE and
Hello! If you copy paste the embed-code from a YouTube-Video like this: the tag is missing its classid-attribute and will therefore be ignored by IE. Now I have the sitaution that I need to alter the parameters of the object but cannot as IE will simply ignore them. I'd like to do sth like this now: $('object').each(function(){ $(this).attr('classid','clsid:D27CDB6E- AE6D-11cf-96B8-44455354'); }); The Problem seems to be that IE decides really early not to accept the , at least before $(document).ready Anyone got an idea when to insert the attribute into the object, so IE will accept it? Thanks alot!
[jQuery] Re: css method on span reports block?
Looks like this is a 1.3.2 issue I think. Just tried it with 1.2.6 and it returned inline in both cases. On Mar 1, 6:31 pm, sliver wrote: > Im not sure if this is intended, but it leads to some unexpected > results: > > console.log($('').css('display')); --> 'block' > > According to W3, span's default display value is inline. Any reason > for the switch? > > Also, say you have a class definition in a style sheet: > .inline { > display: inline; > > } > > console.log($('').addClass('inline').css('display')); --> > 'block' > > I would expect it to report 'inline'...
[jQuery] IE won't show changes made on $(document).ready?
Hello! I am doing the following in order to remove those new YouTube- Headlines on a blog: $(document).ready(function(){ $('param').each(function(){ var oldname = $(this).attr('value'); var check = oldname.search(/youtube.+/); if (check != -1){ var showinfo = oldname.search(/showinfo.+/); if (showinfo != -1){ var newname = oldname+'&showinfo=0'; $(this).attr('value',newname); } } }); $('embed').each(function(){ var oldname = $(this).attr('src'); var check = oldname.search(/youtube.+/); if (check != -1){ var showinfo = oldname.search(/showinfo.+/); if (showinfo != -1){ var newname = oldname+'&showinfo=0'; $(this).attr('src',newname); } } }); }); This works perfectly on all browsers, except for IE (who knew?). IE will alter the code accordingly (it will display what I want if I copy and paste this "new" code into a blank document and view it in IE) but it will not display the changes made on $(document).ready when I am just loading the page. Do I have to call this before $(document).ready or does anybody understand what I am doing wrong? Thanks!
[jQuery] Re: Pagination control jquery -- Need some help
Sorry I think it has to be: $('.page:visible').hide().prev('.page').show(); and $('.page:visible').hide().next('.page').show(); Or is the second class selection not necessary? On Feb 26, 8:33 pm, Frederik Ring wrote: > Why don't you just do it like: > > $('#prev').css('cursor','pointer').click(function(){ > $('.page:visible').hide().prev().show(); > > } > > Same with next. > > $('#next').css('cursor','pointer').click(function(){ > $('.page:visible').hide().next().show(); > > } > > You will pro > > On Feb 26, 5:43 pm, Doug C wrote: > > > I wrote this jquery to basically dynamically build a paging control > > for long articles, etc > > I have it dynamically generating a UL, a page selector and a drop > > down > > selector and I just need to write a piece that will do a <-Prev and > > Next -> and my brain is having trouble with it. Here is the code in > > simplified form. I also don't have the coding for the contect > > highlighting done yet to show what page we are on. > > > HTML: > > > > This is Page 1 > > This is Page 2 > > This is Page 3 > > This is Page 4 > > > > > > > > > > Here is the Jquery I have that generates it. I just need some help > > getting Prev and Next done. > > > > $(document).ready(function(){ > > //Prestate > > $(".page:not(:first)").hide(); > > $(".page:first").show(); > > //Let's get the # of pages. > > var numPages = $(".page").length; > > var pageNums= ""; > > var prev = "", next=""; > > var i = 1; > > var lister = "<UL id=pageUL>"; > > var selector = "<select id=pageSelect>"; > > $(".page").each(function(i) { > > pageNums+= "<a href=# id="+this.id+" class=pageids>"+(i+1)+",</ > > a> " > > lister+="<LI><a href=# class=pageLI>"+$("#"+this.id).attr('title') > > +"</ > > a></LI>" > > selector+="<option class=pageSE value="+$("#"+this.id).attr('title') > > +">"+$("#"+this.id).attr('title')+"</option>" > > > }); > > > lister+="</UL>"; > > selector+="</select>"; > > //Add the Click events > > $(".pageids").live("click", function(){ > > $("#"+this.id).show(); > > $(".page:not(#"+this.id+")").hide(); > > > }); > > > $(".pageLI").live("click",function(){ > > var ht = $(this).html() > > $(".page").hide(); > > $("DIV[title='"+ht+"']").show(); > > }); > > $(".pageSE").live('click',function(){ > > var ht = $(this).text(); > > $(".page").hide(); > > $("DIV[title='"+ht+"']").show(); > > }); > > //Set the values > > $("#PageNum").html(pageNums); > > $("#headerUL").html(lister); > > $("#DropDown").html(selector); > > > }); > > > > > Thanks in advance. > >
[jQuery] Re: Pagination control jquery -- Need some help
Why don't you just do it like: $('#prev').css('cursor','pointer').click(function(){ $('.page:visible').hide().prev().show(); } Same with next. $('#next').css('cursor','pointer').click(function(){ $('.page:visible').hide().next().show(); } You will pro On Feb 26, 5:43 pm, Doug C wrote: > I wrote this jquery to basically dynamically build a paging control > for long articles, etc > I have it dynamically generating a UL, a page selector and a drop > down > selector and I just need to write a piece that will do a <-Prev and > Next -> and my brain is having trouble with it. Here is the code in > simplified form. I also don't have the coding for the contect > highlighting done yet to show what page we are on. > > HTML: > > This is Page 1 > This is Page 2 > This is Page 3 > This is Page 4 > > > > > Here is the Jquery I have that generates it. I just need some help > getting Prev and Next done. > > $(document).ready(function(){ > //Prestate > $(".page:not(:first)").hide(); > $(".page:first").show(); > //Let's get the # of pages. > var numPages = $(".page").length; > var pageNums= ""; > var prev = "", next=""; > var i = 1; > var lister = ""; > var selector = "
"; > selector+=""; > //Add the Click events > $(".pageids").live("click", function(){ > $("#"+this.id).show(); > $(".page:not(#"+this.id+")").hide(); > > }); > > $(".pageLI").live("click",function(){ > var ht = $(this).html() > $(".page").hide(); > $("DIV[title='"+ht+"']").show(); > }); > $(".pageSE").live('click',function(){ > var ht = $(this).text(); > $(".page").hide(); > $("DIV[title='"+ht+"']").show(); > }); > //Set the values > $("#PageNum").html(pageNums); > $("#headerUL").html(lister); > $("#DropDown").html(selector); > > }); > > > Thanks in advance.
[jQuery] Re: Does a plugin like this excist allready
Just use "$('#id').show(speed);" and "$('#id').hide(speed);" See: http://docs.jquery.com/Effects/show#speedcallback
[jQuery] Re: Multiselect listbox
The thing is you will not select a named element by $('.name') but an element of the class "name". How does your HTML look like? On Feb 25, 12:14 pm, Bluesapphire wrote: > Hi! > Thanks for guidance. I have changed JS code as follows. And now it > is totally ignoring the check. > > My listbox name is "zonelocation[]" . I have used name with/without > DOT in JQUERY identifier placeholder. The result is same. > > /*/ > var zonelocationVal; > > jQuery(.'zonelocation[]').each(function(){ > > if(jQuery('.zonelocation[]').attr('checked') == 'checked'){ > zonelocationVal = true; > } > }); > /*/ > > What Iam doing wrong? > > Thanks in advance. > > On Feb 25, 3:45 pm, Frederik Ring wrote: > > > Also remove the else-part of the attribute checking, this way it'll > > only return true if the last element is checked. > > > On Feb 25, 11:41 am, Frederik Ring wrote: > > > > 2 things: you are referring to multiple checkboxes, but do that with > > > an ID (#zonelocation). That will not work. Use a class instead. > > > > Second: Depending on the type of your checkboxes and your DOCTYPE you > > > might need to change the attr('checked') == 'checked' according to > > > your needs. I only used this as a placeholder. > > > > On Feb 25, 11:26 am, Bluesapphire wrote: > > > > > Thanks for guidance. > > > > > My JS code is as follows: > > > > // > > > > var zonelocationVal; > > > > > jQuery('#zonelocation').each(function(){ > > > > if(jQuery('#zonelocation').attr('checked') == > > > > 'checked'){ > > > > zonelocationVal = true; > > > > } > > > > else{ > > > > zonelocationVal = false; > > > > } > > > > }); > > > > > /***/ > > > > > Problem is that, if I select atleast one record, even then > > > > 'zonelocationVal' is always false. > > > > > Can you guide me , how to solve this problem. > > > > > Thanks in advance > > > > > On Feb 25, 2:04 pm, Frederik Ring wrote: > > > > > > You could do sth like: > > > > > > var ok = false; > > > > > > $('.elementInListbox').each(function(){ > > > > > if ($(this).attr('checked') == checked){ok = true);} > > > > > > }); > > > > > > You will have to set your attributes according to the type of your > > > > > elements though. > > > > > > On Feb 25, 9:55 am, Bluesapphire wrote: > > > > > > > Hi! > > > > > > How can i check that atleast one option is selected in > > > > > > multiselect > > > > > > listbox. How can this be done through JQUERY. > > > > > > > Thanks in advance- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - > >
[jQuery] Re: Multiselect listbox
Also remove the else-part of the attribute checking, this way it'll only return true if the last element is checked. On Feb 25, 11:41 am, Frederik Ring wrote: > 2 things: you are referring to multiple checkboxes, but do that with > an ID (#zonelocation). That will not work. Use a class instead. > > Second: Depending on the type of your checkboxes and your DOCTYPE you > might need to change the attr('checked') == 'checked' according to > your needs. I only used this as a placeholder. > > On Feb 25, 11:26 am, Bluesapphire wrote: > > > Thanks for guidance. > > > My JS code is as follows: > > // > > var zonelocationVal; > > > jQuery('#zonelocation').each(function(){ > > if(jQuery('#zonelocation').attr('checked') == 'checked'){ > > zonelocationVal = true; > > } > > else{ > > zonelocationVal = false; > > } > > }); > > > /***/ > > > Problem is that, if I select atleast one record, even then > > 'zonelocationVal' is always false. > > > Can you guide me , how to solve this problem. > > > Thanks in advance > > > On Feb 25, 2:04 pm, Frederik Ring wrote: > > > > You could do sth like: > > > > var ok = false; > > > > $('.elementInListbox').each(function(){ > > > if ($(this).attr('checked') == checked){ok = true);} > > > > }); > > > > You will have to set your attributes according to the type of your > > > elements though. > > > > On Feb 25, 9:55 am, Bluesapphire wrote: > > > > > Hi! > > > > How can i check that atleast one option is selected in multiselect > > > > listbox. How can this be done through JQUERY. > > > > > Thanks in advance- Hide quoted text - > > > > - Show quoted text - > >
[jQuery] Re: Multiselect listbox
2 things: you are referring to multiple checkboxes, but do that with an ID (#zonelocation). That will not work. Use a class instead. Second: Depending on the type of your checkboxes and your DOCTYPE you might need to change the attr('checked') == 'checked' according to your needs. I only used this as a placeholder. On Feb 25, 11:26 am, Bluesapphire wrote: > Thanks for guidance. > > My JS code is as follows: > // > var zonelocationVal; > > jQuery('#zonelocation').each(function(){ > if(jQuery('#zonelocation').attr('checked') == 'checked'){ > zonelocationVal = true; > } > else{ > zonelocationVal = false; > } > }); > > /***/ > > Problem is that, if I select atleast one record, even then > 'zonelocationVal' is always false. > > Can you guide me , how to solve this problem. > > Thanks in advance > > On Feb 25, 2:04 pm, Frederik Ring wrote: > > > You could do sth like: > > > var ok = false; > > > $('.elementInListbox').each(function(){ > > if ($(this).attr('checked') == checked){ok = true);} > > > }); > > > You will have to set your attributes according to the type of your > > elements though. > > > On Feb 25, 9:55 am, Bluesapphire wrote: > > > > Hi! > > > How can i check that atleast one option is selected in multiselect > > > listbox. How can this be done through JQUERY. > > > > Thanks in advance- Hide quoted text - > > > - Show quoted text - > >
[jQuery] Re: Multiselect listbox
You could do sth like: var ok = false; $('.elementInListbox').each(function(){ if ($(this).attr('checked') == checked){ok = true);} }); You will have to set your attributes according to the type of your elements though. On Feb 25, 9:55 am, Bluesapphire wrote: > Hi! > How can i check that atleast one option is selected in multiselect > listbox. How can this be done through JQUERY. > > Thanks in advance
[jQuery] Re: Rich text Editor
Are you using a plugin or are you trying to do oit by yourself? In case you are doing it by yourself this thread might help: http://groups.google.com/group/jquery-en/browse_thread/thread/6902e3e091ec9e4b/f8a135f66d533265#f8a135f66d533265 Works both with selected text and no selection (cursor). On Feb 25, 6:28 am, anjith wrote: > Hi, > > I am trying richtext editor the problem is on every button click (Like > Bold or Code) how to send the tags([b][/b] or [code][/code]) to the > last mouse or courser point in the textarea > > Thanks and regards, > Anjith
[jQuery] Re: Selecting dynamically created elements
By the way (although I do not think it causes the problem) you are missing a ">'" there. Should be: $('').appendTo("#table"); instead. On Feb 23, 9:07 pm, Frederik Ring wrote: > Usually you should be able do what you are trying to do. To me it > sounds as if you are trying to select the dynamically created content > before you created it (on $(document).ready for example). How and when > are trying to get the $('img')-selection? > > On Feb 23, 8:55 pm, Petar wrote: > > > I'm creating elements dynamically like this: > > > $(' > > Later on, if I create a wrapped set $('img'), dynamically created > > images are not in it. I guess that's the way jQuery works, but can I > > do something to wrap newly created elements that are not in HTML? > >
[jQuery] Re: Selecting dynamically created elements
Usually you should be able do what you are trying to do. To me it sounds as if you are trying to select the dynamically created content before you created it (on $(document).ready for example). How and when are trying to get the $('img')-selection? On Feb 23, 8:55 pm, Petar wrote: > I'm creating elements dynamically like this: > > $(' > Later on, if I create a wrapped set $('img'), dynamically created > images are not in it. I guess that's the way jQuery works, but can I > do something to wrap newly created elements that are not in HTML?
[jQuery] Re: Is it possible to override a link?
This should be working: $('a#woof').click(function(e){ e.preventDefault(); //do ajax form }); Or you could set all href attributes to '#' before adding the click function
[jQuery] Re: problems getting HREF attribute in click event
Ok, so now I think I get what you want to do - I was running around wondering why you had the preventDefault() in there. In your case the click event isn't bound to the but to your #wiki_article_list since you are chaining it after the append(). If you would do it like: $( '#wiki_article_list' ).append( ''+title+'' ); $('#wiki_article_list).children('li:last').children('a').click(function ( event ){ //whatever }); you'd have the "this" you expected in the first place!
[jQuery] Re: problems getting HREF attribute in click event
I don't know what else is contained in your #wiki_article_list, but since you appended the just right before this should work: $(this).children('li:last').children('a').attr('href')
[jQuery] Re: problems getting HREF attribute in click event
Because this in your context refers to the #wiki_article_list Refer to the a as a descendant of $(this) instead On Feb 22, 9:34 pm, hybris77 wrote: > can anyone help me to get the href attribute to send off with the > function in this code please > > $("Item", xmlData).each(function(){ > var title = $(this).find( "Text" ).text(); > var url = $(this).find( "Url" ).text(); > var desc = $(this).find( "Description" > ).text(); > $( '#wiki_article_list' ).append( ' class="wikiLinks" > href="'+url+'">'+title+'' ) > .click(function( event ){ > event.preventDefault(); > > // why don't I get the href > attribute here ? > > var url = > $(this).attr('href'); > > getWikiArticle( url ); > }); > }); > > anyone?
[jQuery] Re: How to get the selected text inside a textarea
Ok, I did it myself (+ the web). In case anyone is interested: function wrapAsLink(url){ var textarea = document.getElementById("myTa"); var len = textarea.value.length; var start = textarea.selectionStart; var end = textarea.selectionEnd; var sel = textarea.value.substring(start, end); var replace = '' + sel + ''; textarea.value = textarea.value.substring(0,start) + replace + textarea.value.substring(end,len); } On Feb 22, 7:11 pm, Frederik Ring wrote: > Hello! > > I don't know if this is a 100% jQuery-specific question, but here's > what I'd like to do: I'd like to add a hyperlink-functionality to a > textarea, so basically I'd just like to wrap a " a>" in plain text around the currently selected range in a textfield > using the URL specified in a dialog window (it gets saved as html > lateron). > > That's all of the functionality I need (and want to allow) so I think > it would be a little too much to go for one of the markup-editor > plugins around. > > How would the basic approach for this be? > > Thanks alot!
[jQuery] How to get the selected text inside a textarea
Hello! I don't know if this is a 100% jQuery-specific question, but here's what I'd like to do: I'd like to add a hyperlink-functionality to a textarea, so basically I'd just like to wrap a "" in plain text around the currently selected range in a textfield using the URL specified in a dialog window (it gets saved as html lateron). That's all of the functionality I need (and want to allow) so I think it would be a little too much to go for one of the markup-editor plugins around. How would the basic approach for this be? Thanks alot!
[jQuery] Re: how to use sortable and dragable on the same element?
When you have two sortable lists, there's a 'connectWith' option in the $(this).sortable()-command that lets you drag items from one list to the other. You can also specify callbacks for the removal and receiving of list items via remove:function and receive:function. Sth like this: $('#list1').sortable({cursor:'move',connectWith:$ ('#list'),remove:duplicateItem,receive:integrateItem}); It's actually pretty easy. See: http://docs.jquery.com/UI/Sortable#options
[jQuery] Re: Event handling/propagation question
I think it should be also working just this way: $('#mydiv').css('cursor','pointer').click(function(){ $(this).addClass('selected'); }); No need to select all the contents "manually". On Feb 20, 5:16 pm, spaceage wrote: > OK, so you have to independently assign a handler to all descendant > elements in the ? Is there no better way via the parent div? > > On Feb 20, 8:07 am, Liam Potter wrote: > > > $(document).ready(function () { > > $("div.clickable_element p").click( function () { > > $(this).parents("div.clickable_element").toggleClass("selected"); > > }); > > > }); > > spaceage wrote: > > > A question re: event handling/propagation: I have a surrounding > > > and I want any click within the (including a click on any > > > element within the div) to toggle the addition/removal of a class on > > > the . > > > > In this example, if the user clicks on one of the elements within > > > the , my toggle doesn't work--I'm assuming because the > > > event.target is the element and not the , so the add/ > > > removeClass isn't performed on the parent . > > > > html: > > > > > > > > > > > > element title > > > element label > > > status text > > > > > > > js: > > > - > > > $(document).ready(function(){ > > > $('div.clickable_element').toggle( > > > function(event) { > > > $(event.target).addClass('selected'); > > > }, > > > > function(event) { > > > $(event.target).removeClass('selected'); > > > } > > > ); > > > > Is the way to handle this to attach separate toggle functions to the > > > elements with an alternate selector to target the parent , or > > > is there a cleaner way to handle this situation? > > > > TIA--David > >
[jQuery] Re: Can’t set CSS using variable
I just tried your approach and everything worked just the way it should. Can you post the rest of your code? How do you handle the event that changes the CSS? On Feb 19, 6:41 pm, davis wrote: > I am trying to dynamically set css with variables I retrieve from what > a user types into a textfield. > > This is the line of code: > > $(get_elem_hierarchy()).css($(this).data('theCss').theProp, $ > (this).data('theCss').theVal); > > Everything works fine. Both the css property and the css value trace > to the console correctly but for whatever reason it won't set it. If I > hardcode it works fine. > > I have tried wrapping quotes around those as well and that doesn't > work either so that's not the issue. > > Am I missing something? I've looked all over and can't find anything > that even remotely comes close to discussing this issue so maybe I'm > going about this the wrong way. > > Any help would be greatly appreciated.
[jQuery] Re: Bad Syntax? $('body').append(''); breaks script
Well, since your jQuery seems to be ok, the problem should be the variable you're trying to read. Can you access it with a simple console.log('multipliedweight') or will this also return 'undefined'? On Feb 19, 8:10 pm, Zaliek wrote: > A test page is located http://www.procycle.us/ > test.html">here. > > I'm attempting to insert an extra hidden input field with the extra > weight whenever an item in our shopping cart page has a quantity of 2 > or more. Problem is this specific part of the code: > > $('body').append(''); > > causes an externally linked array named domesticpriorityarray to > become undefined according to firebug. If I remove the problem code: > > $('body').append(''); > > then the script works properly. > > I'd appreciate any insight you can give. Thank you!
[jQuery] Re: Auto-Replacing HTML-entities
Perfect! I'm not exactly good at PHP, so I didn't know about that, but it seems to be exactly what I am looking for! Thanks! On Feb 18, 2:19 pm, Michael Lawson wrote: > Since you're saving it with php why not just use the php functions that do > the same? > > http://us3.php.net/htmlentities > > cheers > > Michael Lawson > Content Tools Developer, Global Solutions, ibm.com > Phone: 1-919-517-1568 Tieline: 255-1568 > E-mail: mjlaw...@us.ibm.com > > 'Examine my teachings critically, as a gold assayer would test gold. If you > find they make sense, conform to your experience, and don't harm yourself > or others, only then should you accept them.' > > From: Frederik Ring > > > To: "jQuery (English)" > > > Date: 02/18/2009 08:14 AM > > > Subject: [jQuery] Auto-Replacing HTML-entities > > > Hello! > > I have setup a simple editor site for a image gallery where the user > can visually edit (sort entries, add entries, edit captions) the HTML > of a . When finished the content gets saved via PHP. Is there a > simple way to have special characters in image captions converted into > HTML entities? > > The way I read the then transmitted is: > > var html = $('#container').html(); > $('#textfield').text('html'); > > The content of the #textfield is then written into a new HTML file. Is > there a jQuery-way to do it or would I have to use a RegExp? > > Thanks! > > graycol.gif > < 1KViewDownload > > ecblank.gif > < 1KViewDownload
[jQuery] Auto-Replacing HTML-entities
Hello! I have setup a simple editor site for a image gallery where the user can visually edit (sort entries, add entries, edit captions) the HTML of a . When finished the content gets saved via PHP. Is there a simple way to have special characters in image captions converted into HTML entities? The way I read the then transmitted is: var html = $('#container').html(); $('#textfield').text('html'); The content of the #textfield is then written into a new HTML file. Is there a jQuery-way to do it or would I have to use a RegExp? Thanks!
[jQuery] Re: How to make an element *not* have a function attached...
Ok, then you could do it like this: $(document).ready(function(){ $('#mytextarea').each(function(){ $(this).expandable(); }); $('#myButton').click(function(){ $('#mytextarea').unbind(); }); }); Although I might think there is a more elegant way to do this? Hope it helps though. On Feb 13, 8:43 pm, "Rick Faircloth" wrote: > To answer your question, hopefully, the element, in this case a textarea, > is set up like this: > > > > $(function() { > $('#myTextarea').expandable(); > }); > > > > ...and that's it. It would be active as "expandable" all the time. > > So, there's no "event", like click, etc., that triggers the function. > > However, I want to be able to click a link and disable the "expandable" > functionality, until another link is clicked to re-enable the functionality. > > In other words, having the textarea "expandable" is not something I want > on all the time. > > > -Original Message- > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of Frederik Ring > > Sent: Friday, February 13, 2009 2:04 PM > > To: jQuery (English) > > Subject: [jQuery] Re: How to make an element *not* have a function > > attached... > > > This should be done using $(this).unbind(event,function). > > I don't know from your example how your handle the event so I cannot > > give you a more specific answer. > > > On Feb 13, 7:57 pm, "Rick Faircloth" wrote: > > > Strange question, perhaps...but... > > > > If I have an element that has an function from a plug-in > > > attached to it, such as: > > > > $(function() { > > > $('#myTextarea').expandable(); > > > > }); > > > > How would I then be able to make #myTextarea "not .expandable"... > > > > $('#myTextarea').expandable('disable'); ... > > > > Is this something that can be controlled from the page code, or > > > does something have to be built into the plug-in to allow this? > > > > Thanks, > > > > Rick
[jQuery] Re: How to make an element *not* have a function attached...
This should be done using $(this).unbind(event,function). I don't know from your example how your handle the event so I cannot give you a more specific answer. On Feb 13, 7:57 pm, "Rick Faircloth" wrote: > Strange question, perhaps...but... > > If I have an element that has an function from a plug-in > attached to it, such as: > > $(function() { > $('#myTextarea').expandable(); > > }); > > How would I then be able to make #myTextarea "not .expandable"... > > $('#myTextarea').expandable('disable'); ... > > Is this something that can be controlled from the page code, or > does something have to be built into the plug-in to allow this? > > Thanks, > > Rick
[jQuery] Re: toggle question
How do you select the items to toggle and how are the Maxi & Mini - images arranged in the HTML. If you have 2 things toggling at the same time it looks like you are doing somehting wrong with the selection. On Feb 12, 10:00 pm, Alain Roger wrote: > Hi, > > I would like to simulate the maximize/minimize window effect. So i created > an image Maxi and an image Mini. > maxi is displayed by default. When user click on this image, a div should be > displayed (no problem for that point) and the Mini image should be displayed > instead of Maxi. > for sure, if user click on mini image, in this case the div will disappear > and the maxi image should replace the mini one. > > from my point of vie this is typically a toggle system but how to implement > it in jQuery ? > i was looking at Toggle function but every time there are minimum 2 similar > tag from which the toggle is applied :-( > > thanks a lot, > > -- > Alain > --- > Windows XP x64 SP2 / Fedora 10 KDE 4.2 > PostgreSQL 8.3.5 / MS SQL server 2005 > Apache 2.2.10 > PHP 5.2.6 > C# 2005-2008
[jQuery] Re: onClick event on content loaded by ajax
If I get you right you have to put your function into the callback part of your $(this).load(that); via $(this).load(url, {},myCallbackFunction()); The callback-function will be executed when the ajax-call has been completed and should do what you are asking for. On Feb 12, 7:28 pm, oli wrote: > Hi there, > > I couldn't find any solutions for my problem, so I'm asking here. I > have a form that was previously loaded by ajax and which I want to > submit also with ajax. > > unfortunately, the jQuery(document).ready function has been executet > before the form was loaded, and so the event handler onClick for the > submit link isn't called when I click on the button in the form. > > So, > jQuery("#submit-register-form").click(function() { > alert('yay');} > > doesn't work if the form has been loaded by ajax, but does work if I > load it on site load. > > How can I solve this? > > Regards, > Oli
[jQuery] Re: uncheck specific checkbox
Well thanks for that, I didn't know and it seems to work perfectly But why is it then when I do something like an alert($(mycheckbox).attr ('checked')); on an unckecked checkbox it returns false? On Feb 12, 5:46 pm, mkmanning wrote: > In HTML checked is a boolean (of sorts), its presence is sufficient, > you don't need to set it to anything; if you want something unchecked > you should remove the 'checked' attribute. In XHTML, attribute > minimization is forbidden (i.e. attributes can't be empty), so the > proper syntax is checked="checked" (for disabled it's > disabled="disabled", etc.) > > Use removeAttr() instead of setting the value to false. > > On Feb 12, 8:26 am, Frederik Ring wrote: > > > Hi! > > > The thing is that somwhow (don't ask me why) the unchecked attribute > > of a checkbox is '' instead of 'false'. > > > This worked fine with me: > > HTML: > > > name="cb01"> > > > name="cb02"> > > > name="cb03"> > > > name="cb04"> > > > jQuery: > > $(document).ready(function(){ > > $('.childcheckbox').change(function(){ > > $(this).prev('.parentcheckbox').attr('checked',''); > > }); > > > }); > > > On Feb 12, 4:57 pm, Andy wrote: > > > > Hey guys, > > > > I'm trying to uncheck a checkbox that is inside my flexigrid. I have > > > a checkbox in the header and the column has all checkboxes. What I'm > > > trying to do is if I select the top checkbox (so all of the checkboxes > > > below are selected), I would like to uncheck that checkbox if any of > > > the other checkboxes in that column are unchecked. > > > > I'm using the following code, but when it runs through this, it > > > unselects all of the items, instead of just the header. > > > > Code snippet: > > > > > > var rItem = document.getElementById("chk_col_" + colName); > > > $("inp...@name=" + rItem.name + "][type='checkbox']").attr('checked', > > > false); > > > > > > > The checkbox is named correctly, so I'm not sure why this isn't > > > working. > > > > Thanks!
[jQuery] Re: uncheck specific checkbox
Hi! The thing is that somwhow (don't ask me why) the unchecked attribute of a checkbox is '' instead of 'false'. This worked fine with me: HTML: jQuery: $(document).ready(function(){ $('.childcheckbox').change(function(){ $(this).prev('.parentcheckbox').attr('checked',''); }); }); On Feb 12, 4:57 pm, Andy wrote: > Hey guys, > > I'm trying to uncheck a checkbox that is inside my flexigrid. I have > a checkbox in the header and the column has all checkboxes. What I'm > trying to do is if I select the top checkbox (so all of the checkboxes > below are selected), I would like to uncheck that checkbox if any of > the other checkboxes in that column are unchecked. > > I'm using the following code, but when it runs through this, it > unselects all of the items, instead of just the header. > > Code snippet: > > var rItem = document.getElementById("chk_col_" + colName); > $("inp...@name=" + rItem.name + "][type='checkbox']").attr('checked', > false); > > > The checkbox is named correctly, so I'm not sure why this isn't > working. > > Thanks!
[jQuery] Re: gettng value from radio buttons
Hi! You could do it like this: $(document).ready(function(){ $('input:radio[name=\'optns\']').click(function() { var optns = $(this).val(); alert (optns); }); }); You'll have to remove your onclick-s then. On Feb 12, 3:22 pm, "angelochen...@gmail.com" wrote: > Hi, > > I have two radio buttons, when user click I'd like to know what is > value selected now inside updateoptns, but the code below always > return '0', > any idea how to do this? Thanks, > > Angelo > > > onClick="updateoptns()" type="radio" value="0" /> > value="1" /> Metric (kg/cm) > > > function updateoptns() { > var optns = jQuery("inp...@name='optns']"); > alert(optns.val()); > }
[jQuery] Altered SWF not updating
Hello! I am using jQuery to alter the parameters of embedded YouTube-Videos. This works fine with browsers that use the portion of the code (Opera & FF), whereas the browsers who use the part (IE & Chrome) will update the code accordingly but not refresh the Video. What I am using is the following: $(document).ready(function(){ $('param').each(function(){ var oldname = $(this).attr('value'); var check = oldname.search(/youtube.+/); if (check != -1){ var newname = oldname+'&showinfo=0'; $(this).attr('value',newname); } }); $('embed').each(function(){ var oldname = $(this).attr('src'); var check = oldname.search(/youtube.+/); if (check != -1){ var newname = oldname+'&showinfo=0'; $(this).attr('src',newname); } }); }); Anybody got any idea how to get the -browsers to refreshing the display? Thanks!
[jQuery] Re: Selecting the s inside an object
Totally sorry! I messed up 'name' and 'value', so I tried to augment the 'name' of the . No wonder it didn't work! Works absolutely fine with: $('param').each(function(){ var newname = $(this).attr('value')+'&showinfo=0'; $(this).param('value',newname); }); Thanks!
[jQuery] Selecting the s inside an object
Hi! I think this is a simple question but I somehow cannot solve it myself. I'd like to remove those new Youtube-Headings on a blog by adding '&showinfo=0' to the Youtube-URLs. It works absolutely fine with the s by doing this: $('embed').each(function(){ var newname = $(this).attr('src')+'&showinfo=0'; $(this).attr('src',newname); }); Since the -tag gets its parameters from the nested I somehow don't manage to access these. How do I access the name-parameter of each object? Thanks! Frederik
[jQuery] Re: How to get html string including the selected element
So you could just either wrap it in a dummy-div or add the and code manually?
[jQuery] Re: How to get html string including the selected element
Why can't you just read the html() of the element containing your #test?