<li>This header of sublist
<ul><li>item1</li>
<li>header of subsublist
[code].....
Now I would like to wrap the text and only the text (i.e. 'This header of sublist', 'item 1', 'header of subsublist','item2.1') in a <span> tag. I tried $('li', his).wrapInner('<span class="test"></span>') but that includes the ul element as well, which I would like to exclude.regards,
[URL]..I want to wrap some html code to user's selected text inside the textarea, I tried the code in above url but it seems not work in IE, is there a plugin of any way to make it work?
How can I wrap text inside a select box? or perhaps I could allow the select box to flow over the div its in. That might actually be better now that I think of it :)
Using the jquery cycle code to display fade images in exactly as the demo shows. So far, so good.But, I want to add some 'static' text that doesn't fade with the images and will 'wrap' around those images. So, I want the images on the left and some text on theiright which will wrap around the images.
I have been trying to figure out how to find all instances of a certain word or phrase within an element and wrap those words in <span> tags or other html. I.e. change all instances of 'the keywords' to <span>the keywords</span>So far I've found a lot of references to :contains() but that will change the element the text is inside of rather than just the text itself
I am trying to wrap <a> tags around text in <li> elements. How can I get the index of the <li> in the <ul>? I tried something like this: $('.tabbed-list li').wrapInner('<a></a>'); That works fine. However, I want to do something like this: $(this).wrapInner('<a href="#' + $(this).index() + '"></a>');
I have to wrap text in a td in firefox. My text is long single word like How can I wrap it to fit the width of the td. At the moment it is expanding the width of the whole table.
I searched about this problem over Internet and found the same result many times, I found this example on stackoverflow [URL] but this example didn't work in my project; I am making a toolbar with buttons that insert HTML tags around the selected text in a <textarea>, this exemple didn't work because when the user click on a button the selected text won't be selected anymore because <textarea> loses focus and selected text will be unselected, I am targeting Firefox and compatible browsers so you don't need to give me the IE code; jQuery codes are accepted;
If I were to using single images, I would use CSS 'float left' to have my text appear on the right side of the image, but with JS I cannot seem to do this.
My text drops below the slideshow and then I have this ugly white area to the right of my slideshow. I have tried MANY scripts and just cannot figure this one out.
The script I am using now has the main scripting in the <head> section, but this is what I have going on in the <body>:
This scroller shows images that fade out to be replaced by other images of the same size. I would like to wrap text around the slideshow.If the slideshow were an image, all I would have to do is:
how to properly add some text content before and after a user's selection?I am working with the TinyMCE editor, and I can get the following from it:
* User's selection as a W3C compatible range * User's selection as a browser selection object * User's selection as a node (element) that encompasses the user's selection
I also need the user's selection to remain selected after being wrapped.I've looked all over the web and could find nothing (except running into my OWN previous questions about this).Here's an example of what I'm trying to do:
[URL]
First line is original text, second line a part is selected, third line the selection is wrapped and the selection remains selected.
I am loading a link with ajax. When the link pops on the screen and I click it, I get redirected to my 404 page and my lightbox doesn't load. If the link pops in and I refresh my browser, then I click the link my lightbox will show up. How can I do a prevent default on the <a href> in pure JS? No frameworks.
I've been pretty infatuated with JSON for some time now since "discovering" it a while back. (It's been there all along in JavaScript, but it was just never "noticed" or used by most until recently -- or maybe I should just speak for myself.)
The fact that JSON is more elegant goes without saying, yet I can't seem to find a way to use JSON the way I *really* want to use it: to create objects that can be instantated into multiple instances without prototyping. I've seen (and used) JSON for singleton object instances -- this not a problem and this is how it works right out of the gate.
But given the following custom object written the past "normal" way, I would like to write it in JSON format, and then be able to create new instances from the one definition. Here's an example using the "old way" most who have been writing JavaScript for years have seen:
But neither are really as close to pure JSON as I would like, so that I can instantate those:
var hisPair = new Two( 11, 22 ); var herPair = new Two( 33, 44 );
What I'd like is a way in PURE JSON to be able to create the Two class (as an example) using pure JSON. I've not seen anything yet on the web that addresses this directly aside from some pages which require you to include another JS to allow "deep embedding" of classes using other helper "classes" (that are created the "old way" it seems), etc.
The best I've found so far on using pure JSON to create a class that allows *multiple* instances is something like this:
function Two( x, y ) {
var class = { x : x, y : y, sum : function { return this.x + this.y } max : function () { return this.x this.y ? this.x : this.y } min : function () { return this.x this.y ? this.y : this.x } pow : function () { return Math.pow( this.x, this.y ) } };
for (var element in class) this[element] = class[element];
}
Now *THAT* works, but it's still not as "pure" I would like. But it's acceptable for now, I guess, since I *am* creating the entire "class" as a JSON object, and I consider the outside function "wrapper" as the necessary "constructor." But I keep wondering... There HAS to be a better way.
I'm just wondering if anyone knows of a place that discusses JSON used in situations like the above. Again, I've seen an ABUNDANCE of pages and sites that discuss JSON in Singleton usage, but nothing that discusses it as I am wanting here.
i'm doing a forum and i want it to have button that wraps the text with , i mean when the text is selected it will wrap the selected text with [quot] in the beginning and [/quote] in the end, but if non of the text is selected i want it to just write [quot].
Is it possible to wrap a tag around another tag with javascript, but without using jQuery?
For example to put each IMG tag inside a SPAN ? Lets say I have [code]...
It can't be done with insertAdjacentHTML - if I try to add only the opening tag, the browser automatically appends the closing tag right after it. If I try to add only the closing tag, just nothing happens.
im trying to get the syntax down to find all img tags that are NOT surrounded by tags and wrap those img tags in tags. I can get the selector to get all img tags and wrap it in a tag but i need to further take it to disregard the img tags that already are wrapped in pseudocode $(img parent tag not equal to p).each().....
Okay guys what I would like to do is add a class to this:
.wrap("<a href='" + item.link + "'></a>"); So that i can style this link
.wrap("<a class="grouped_elements" href='" + item.link + "'></a>"); When i try to use the second approach i get an error that reads: missing ) after argument list
I am creating breadcrumbs using XML with the following code: // <![CDATA[ var root = null; $(document).ready( function(){ $.get( "/_assets/xml/sitemap.xml", function( data ) { root = data; var pathname = window.location.pathname; var local_url = "*[url=" + pathname + "]"; var currpage = $(root).find(local_url).attr("name"); var parentEls = $(root).find(local_url).parents(); var mapped = $(parentEls).map(function () { var element = $(this).attr("name"); var element_url = $(this).attr("url"); var element_wrap = $(this).wrap('<a href="' + element_url + '"/>').attr("name"); return element_wrap; }).get() .reverse() .join(" / "); $("#breadcrumb").append("<p>" + mapped + " / " + currpage + "</p>"); });}); // ]]>
The breadcrumbs are displaying perfectly, I'm just having a hard time inserting the <a> tag via .wrap() here: var element_wrap = $(this).wrap('<a href="' + element_url + '"/>').attr("name"); I want to attach a link to each element's URL and return the name of the tag. The <a> tags aren't being applied here, what am I doing wrong?
<label for="field_id">Field Name</label> <input type="..." id="field_id"/> <!-- or textarea/button/select -->
...I'm doing this...
$(':input').each(function(){ var $field = $(this).wrap('<div class="wrapper"/>'); var $wrapper = $field.parent(); var $fieldID = $field.attr('id'); [Code]...
It feels pretty clumsyIs there a more elegant way? Maybe even through chaining? Sometimes the <label/> will be before the field and sometimes after...