Remove Style From Selected (Highlighted) Span / Text In DIV

Aug 1, 2010

I have many divs with spans inside(just like it is below-no extra ids,classes for spans:
[...]
<div>
<span style="color:red;">a</span>
<span style="color:blue;">b</span>
<span style="color:white;">c</span>
</div>
<div>
<span style="color:red;">d</span>
<span style="color:blue;">a</span>
<span style="color:white;">a</span>
</div>
[...]

What I would like to achieve: user selects with mouse "ab", click button(input type=button) which remove style from selected span/spans. Similar behavior like it is in TinyMCE.

View 6 Replies


ADVERTISEMENT

Grabbing Highlighted/selected Text

Apr 27, 2007

I am wondering if it is at all possible to create a button that--when
clicked--grabs a paragraph of text that a user has highlighted. So you
go to this website, then highlight a section of text. Once you have
the text selected with you mouse, you then click the button. The
button executes a function which acquires the selected text in a
string. Is this hypothetical situation possible? Thank you for the
time it took to read this post.

View 1 Replies View Related

Jquery :: Script To Extract Text From LI - Span Also Selected?

Mar 15, 2010

I currently have a script that extracts the text from an li using:
$('li').text();
simply enough.
But I have span within the li, and the text within the span is also being selected. Is there a way to remove the span text from the selection?

View 4 Replies View Related

Selecting Highlighted Text

Aug 11, 2006

It needs to allow the user to highlight some text within a paragraph. If the correct text (with an error) is selected it should provide feedback that the user has correctly selected this text.

So what I need to do is

1. Get the text selection
2. Compare this text selection to a predefined answer
3. Provide feedback to the user e.g. they are correct if text selection = predefined answer, and incorrect if text selection != predefined answer

View 3 Replies View Related

Use Span Style Tag In Html For Mozilla Firefox?

Aug 8, 2009

i want to prevent copy image from website. for that i found a trick.

<SPAN STYLE="background-image: url(hemcircuit.gif)"><IMG SRC="transparent.gif" WIDTH="195" HEIGHT="190" BORDER="0"></SPAN>

where hemcircuit.gif is main image and transparent.gif is tranparent image file .

WIDTH="195" HEIGHT="190" is the width and hight of original pic.

it is working fine in internet explorer but not in Mozilla Firefox.

View 1 Replies View Related

Searching For Highlighted Text On Webpage?

Feb 24, 2009

Is there a way of searching for highlighted words on a webpage?

View 4 Replies View Related

How To Determine Neighbors Of Highlighted Text

Aug 13, 2010

I am a JS newbie and I'm wondering if there a way to figure out the sentence from which a word has been highlighted. Essentially, when a user selects a word or a phrase, I should output the sentence from which it's been selected. Is this possible with JS or with any server side languages?

View 2 Replies View Related

Get Element Without Id - Change Style Of <span> Tags That Are Hovered Over En-masse

Mar 28, 2010

I'm trying to make a javascript function that will change the style of <span> tags that are hovered over en-masse. Meaning every <span> tag with onmouseover and onmouseout with this function will change it's style. Currently, I'm trying to work from the getElementById standpoint, but this is unbelievably tedious.

View 3 Replies View Related

Find Start And End Of Highlighted Text In String

Feb 15, 2007

I am creating a little html editor, and I want to highlight a chunk of
unformatted text, click a <buttonand put a <pand the beginning and
a </pat the end. I assume there is a DOM element relating to this,
can anybody help please ?

View 1 Replies View Related

Jquery :: Remove Span Wrapping Input?

Sep 6, 2011

I want to use jquery to make sure that my HTML forms have the correct structure and classes. What I want:

HTML Code:
<form class="myclass">
<label class="label-class"><span class="there_is_supposed_to_be_a_span_here">Label</label>

[code]....

View 1 Replies View Related

JQuery :: Add/remove Classes To 100 Span Tags (one At At Time) Using A Single Button

Aug 12, 2010

For the HTML I have

<span id="one">Vestibulum </span> <span id="two">tortor</span> <span id="three">quam,</span>

for the JS I have

$("button").toggle(
function () {
$("span").removeClass("big");

[Code].....

this cycles through and does what i need, however i have like 100 span tags ... is there a way to do this without having to identify every span ID ?

View 4 Replies View Related

Hiding Code Between <style Type=text/css">...</style>

Apr 24, 2009

I have built a website and I wish to hide my code between "style type="text/css">....</style>

Is there a way to hide the code between it?

View 5 Replies View Related

How To Remove A Border Style Under IE?

Dec 8, 2006

I have the following problem:

An input field get a border assigned by a style class (e.g. 2px solid red).
When the field gets the focus, we set the border to green.

element.style.border = "2px solid green";

When the field looses the focus, the border should change back to red.
We just want to remove the style we have set, when the field has got the
focus, so that the style class is visible again.

element.style.border = "";

Under Firefox that works but not under IE.
We have changed to the class mode, because we don't want to save the
previous setting and restore it later.

Is there a possibility to remove the style (especially the border style)
under IE, so that the style of the assigned class is visible again?

element.style.removeAttribute doesn't seem to work, but may be I make
something wrong? Code:

View 1 Replies View Related

JQuery :: Find Node Text - Making A Variable Equal The H1 Html() Without The Span Text

Nov 16, 2009

<h1>November<span>2009</span></h1>

making a variable equal the h1 html() without the span text.

// equals 'November2009'
var monthDelete = $('h1').html();
// I need just 'November'

View 1 Replies View Related

How To Remove Style From Parent Element

Dec 10, 2009

Any way to remove styling on a parent element with JS (as it can't be done in CSS). In a situation like this:
Code:
<p><img src="image1.gif"></p>
<p>Brutus aderat forti.</p>
<p><img src="image2.gif"></p>
<p>Caesar adsum jam.</p>

The <p> element has default padding, but I'd like to remove the padding when the <p> contains an image. This was my failed attempt to target the <p> element:
Code:
window.onload = paraPad;
function paraPad() {
var img = document.getElementsByTagName("img");
var imgpara = img.parentNode;
for (i=0; i<imgpara.length; i++) {
imgpara.style.padding = "0";
}}

View 2 Replies View Related

JQuery :: Splitting Text - Truncate Some Text Within A 'span' In Order To Create A 'more/less' Button To Show/hide The Additional

Mar 18, 2011

I am trying to truncate some text within a 'span' in order to create a 'more/less' button to show/hide the additional. I effectively want to turn this:

[Code]...

View 1 Replies View Related

JQuery :: Remove() Doesn't Remove Html Tag And Text Inside

Dec 12, 2011

This time I have a trouble with remove(). Here is my code :

$.each(val.produitsIds,
function (j, val2) {
if($('#chk_' + i).prop("checked")){
//$('#' + val2).prepend("<div>liste des tailles</div>");
$('#' + val2).prepend("<div>" + $('#chk_' + i).attr("value") + "</div>");
}
[Code]...

View 2 Replies View Related

JQuery :: $('<span>').text('new Text') Not Working In IE

Aug 5, 2010

Has anyone seen this before..

var myText = 'blah';
$('<span>').text(myText);

The above correctly sets the text of the span to blah in all browsers except IE. The only way I've gotten it to work in IE is...

$('<span>' + myText + '</span>')

Not the worst hack, but all the extra typing is adding up.

View 5 Replies View Related

Change Selected On Dropdown When A Text Form Is Selected Or Input Is Added?

May 19, 2010

like for example i have text areas named upload1 and upload2when I click or add input on upload1 a drop down list below upload2 will not change, but when I add input on upload2 the dropdown will select "parts"

View 3 Replies View Related

Getting Text From A Span

May 12, 2010

I'm working on a project with span's and event handlers.Basically what I need to do is be able to get the text from within a span when the user mouses over.I know how to set up the event handlers, that's all working fine, my issue is the actual extraction of the text. I've tried using .nodeValue and .TEXT_NODE but these keep coming back null.So is there a way to do something like: var text = document.etElementById ("example"). nodeText;and get a string of text?

View 9 Replies View Related

Three Combo Boxes: Remove Options That Have Been Selected In Others

Jul 7, 2010

I am looking to create a set of three combo boxes with around 15 options in each. If an option is selected in one of the three boxes, it is removed as an option from the others.

Dropbox Box 1 Options: 1,2,3,...,15
Dropbox Box 2 Options: 1,2,3,...,15
Dropbox Box 3 Options: 1,2,3,...,15

[Code].....

So if the user changes there mind before submit, it repopulates each box with the proper items.

View 2 Replies View Related

JQuery :: Add Text Into A <span>?

May 11, 2010

I have this script who will set a text to an existing or newly created <span>. When I executed the script, I can see ths <span> element to the source but the text never appear. Here is the last version of this script (the alert box is displayed but the "_message" is never dispalyed to the page):

var _message = response[inputId];
var $field = $(jqn('#'+inputId));
var $span = $(jqn('#'+inputId+'.errors'));

[Code]...

View 4 Replies View Related

Cell Text In A Span?

May 11, 2010

In the following table segment, I have been trying to use DOM techniques to get the text values.For example in this line: (<span id="edit5_oname" >BOBBY</span>), I only want to get BOBBY. What's happing is if I use alert(x[2].innerHTML); it returns <span id="edit5_ownerid">8</span>.I have tryed various techniques like:

alert(x[2].data);
alert(x[2].innerHTML);
alert(x[2].firstChild.nodeValue);

[code]....

View 3 Replies View Related

DOJO - Remove Selected Items In The Grid2 To Grid1?

Sep 13, 2010

I am fetching dataitems(store1) from the json file using IteamFileWriteStore and IteamFileReadStore and storing these items in the EnhancedGrid G1.

<table dojoType="dojox.grid.EnhancedGrid" jsid="grid2" id="grid2" store="store2"
plugins="{indirectSelection: true, selectable: true, dnd: true, nestedSorting: true,
loadingMessage: 'Loading...', errorMessage: 'An error exists within the data.' }"
selectionMode="extended" class="mainDojoTable float-left" style="width:180px;
height:300px;">
[Code]...

After Fetching the data from the grid1 of store1. Now, I need to Remove the Selected items in the grid2 to the grid1. After Removing the Selected items to the grid2 that items should be Added from the grid1.

View 1 Replies View Related

JQuery :: Get Html/text From A Span?

Dec 28, 2011

some how i don't get the inner text of the span

[Code]...

View 4 Replies View Related

Replace Text Of A Document Span?

Feb 15, 2012

I have developed an website with drupal 7.10. I want this should be in bengali language. everything is ok but problem with numerical system. for example: date,time,points etc.

Now I have decided to add java code at the bottom of the theme. so that after loading the page javascript with replace those text. This replacement should be limited to some span not in all document.

I have this as below code in the document

<span class="submitted">, 12/20/2011 - 07:10 <a class="username" title="" href="/user/4">afshalur</a></span>

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved