JQuery :: Clear Selection Of Text On Ul Element

Sep 18, 2009

I am trying to get/set only text of list only element text value. But for some reason I can not select it in clear way. List something like:

<ul>
<li id="myid"> Here text that I want to modify
<ul>
<li id="dfdf">i don't want modify this</li>
<li id="dfdf">i don't want modify this</li>
[Code]...

View 1 Replies


ADVERTISEMENT

W3C Equiv Of Document.selection.clear()

May 9, 2005

According to Google I'm the first person ever to have had this problem. I'm looking for the Gecko equivalent of document.selection.clear() or (better) document.selection.empty().

I'll try to lay out what I'm trying to do. I register an mouseup handler on the document to fire a function to find what text is selected. Code:

View 7 Replies View Related

Clear Form Elements - Multi Selection Does Not Work

Dec 8, 2009

Do you know why js does not reset this multi select box?
<select name="LOB" multiple="multiple" size="5" style="background:#fff3b3;width:150px" >
<option value="DP"
>DP</option>
<option value="DTV"
>DTV</option>
<option value="HSD"
>HSD</option>
<option value="PPV"
>PPV</option>
<option value="RF"
>RF</option>
<option value="VOD"
>VOD</option>
</select>

Code:
function clearForm(oForm) {
var elements = oForm.elements;
oForm.reset();
for(i=0; i<elements.length; i++) {
field_type = elements[i].type.toLowerCase();
switch(field_type) {
case "text":
case "password":
case "textarea":
case "hidden":

elements[i].value = "";
break;
case "radio":
case "checkbox":
if (elements[i].checked) {
elements[i].checked = false;
}
break;

case "select-one":
case "select-multi":
//alert(elements[i].value);
elements[i].selectedIndex = -1;
break;
default:
break;
}}}

View 4 Replies View Related

Clear Text In Conditional Text Area When Radio Unchecked?

Sep 2, 2010

I have a form setup so that selecting a radio button opens a specific text field. The problem is if the user starts to enter information, then switches to a different radio button (perhaps they chose the wrong radio to start), the text they already started to enter on the previous textfield doesn't get cleared. This will be a problem later when inserting to sql.

[Code]...

View 19 Replies View Related

JQuery :: Unwanted Selection Of Html Element

Feb 15, 2011

This is probably more of an HTML question than anything else, so my apologies if it's out of place.I'm using a series of spans within a div to act as filters (selectors) to hide/show various divs. When the user clicks on the text within the span, the span toggles a "selected" class, and also triggers a function to hide the associated divs. My problem is that occasionally the area around the text (the entire span, it would seem) gets "selected" when clicked on and turns blue, obscuring the text. Here are two screenshots, one showing the word "lambs" correctly, the other showing the same word with the unwanted blue background. Question: is there any way to make this not happen? Should I be using different elements as the selectors?

View 3 Replies View Related

Clear Text Field After Submit??

Apr 8, 2004

a user types in his email, and clicks submit he is then taken to the thank you page. he clicks back and his email is still there.

I want the email not to be there. I can change the value of the text field onload but this doesnt work when you click back only when the page is reloaded. i can change the value on submit but this is wrong because then the wrong value is submitted.

View 1 Replies View Related

Clear Form Text Field?

Oct 18, 2010

The javascript below works perfectly using Firefox, but not Opera or IE.I have a button which I would like to clear the text in the input field with.The "onFocus" on the input field works fine in all browsers, but when clicking the "cross.gif"-button, it only works in Firefox.javascript:

Code:
function checkclear(what){
what.value=''

[code]....

View 5 Replies View Related

Clear Content Of Multiple Text Boxes

Jun 22, 2007

I have a couple of radio buttons that hide and reveal DIV tags. Here is what I'm trying to do:

1) radioBTN1 is clicked it reveals DIV1 with multiple text boxes in it
2) radioBTN2 is clicked it reveals DIV2 below DIV1 with multiple text boxes in it
3) the user fills in the text boxes in the DIV2
4) user changes mind and clicks radioBTN1 again to hide DIV2
5) when DIV2 is hidden it resets and clears all previous information

IS this possible to do with javascript? Code:

View 1 Replies View Related

IE Refresh - Clear A Text Input - Use Onclick Instead Of Onchange

Jun 19, 2009

i'd like to know why when I clear a text input in IE via javascript I need to click somewhere on the screen for the change to appear?

document.getElementById("strAuteur").value="";
//This wont trigger a repaint for IE

edit : SOLUTION -> use onclick instead of onchange.

View 4 Replies View Related

Adding Cross To Clear Text From Textbox On Click

Aug 31, 2011

How am I able to add a a cross to the right of a textbox which once click it clears the text from the textbox, sort of like the way Google do it, I have been trying to do this for ages now and can't seem to find a way to do it.

View 5 Replies View Related

JQuery :: Prevent Text Selection In Button?

Apr 15, 2010

If you have an anchor and apply the button widget, text selection in the button is still possible.

View 1 Replies View Related

JQuery :: Diagonal And Vertical Text Selection

May 2, 2011

Is there anything out there that allows for a diagonal and vertical text capture in javascript or jQuery? I was not successful in finding anything. I have a game similar to word find that I've developed, but I need to be able to capture text vertically and diagonally. Otherwise, the only solution will be for me to do a by-click basis to capture items on the screen. I found the script below which handles horizontal capturing:

<script type="text/javascript">
document.body.style.cursor="url(3DArrow.cur), crosshair" ;
if (!window.Kolich){
Kolich = {};
} Kolich.Selector = {};
Kolich.Selector.getSelected = function(){
var t = '';
if (window.getSelection){
t = window.getSelection();
}else if(document.getSelection){
t = document.getSelection();
}else if(document.selection){
t = document.selection.createRange().text;
}return t;
}Kolich.Selector.mouseup = function(){
var st = Kolich.Selector.getSelected();
sel_text=st.replace(/s/gi,"");
if(st!=''){
alert("You selected:"+sel_text);
}}
$(document).ready(function(){
$(document).bind("mouseup", Kolich.Selector.mouseup);});
</script>

View 8 Replies View Related

JQuery :: Change An Element's Text Depending On Another Element's Display Property?

Apr 28, 2011

I'm doing a very simple expand/collapse function using 'slideToggle'. The button that triggers this event simply says 'Expand/collapse'. I want this text to change depending on whether an element is visible or hidden.

[Code]...

View 4 Replies View Related

Way To Prevent Tab Text Highlight / Disable Tab Text Selection

Apr 21, 2011

Here's a sample form:

Code:
<form action="#" method="post">
Name:<br />

[code]...

View 3 Replies View Related

Prevent Tab Text Highlight / Disable Tab Text Selection?

Apr 21, 2011

Here's a sample form:

Code:
<form action="#" method="post">
Name:<br />
<input type="text" name="name" value="your name" /><br />

[Code].....

When you tab to a text input, the value gets highlighted. How can it be disabled?

View 7 Replies View Related

Possible To Prevent Tab Text Highlight / Disable Tab Text Selection?

Apr 21, 2011

Here's a sample form:

<form action="#" method="post">
Name:<br />
<input type="text" name="name" value="your name" /><br />

[code]....

View 1 Replies View Related

JQuery :: Changing An Option Element Into A Text Input Element?

Nov 18, 2011

Is this possible with JQuery? I have the following code which I think Should do this, but it's not working :/These are two different functions which I've been testing, and the html element is supposed to create a dropdown list via some PHP which will have the option "Other" within it. Unfortunately, I have no idea exactly how to turn "Other" into a text box when the user clicks, and I've been spending a lot of time on this already.

[Code]...

View 1 Replies View Related

JQuery :: Raise Event On Certain Text Selection In Html Page?

Mar 11, 2011

suppose i have a html page with text, links and what ever else a page contains. On selection of Text on the html page i want to raise some event that will do something. But what that event is known as? By text selection i mean placing mouse pointer to some text and left clicking and moving the mouse either to left or right. Now when user selects some portion of text and releases the mouse's left click button a event should be raised. Obviously that event should know what was the selected text. So is it possible ?

View 1 Replies View Related

Clearing Element After Changing Earlier Selection

Mar 15, 2007

I know how to do this the hard way, but I suspect that there's an easier option. I'm creating a program that requires a series of 4 or 6 select menus. Something like this: Code:

View 2 Replies View Related

Don't Clear Part Of Form When The "Clear All" Button Is Clicked?

Dec 10, 2011

I have a search form and added the "Clear All" Button functionality...but it clears the last part of the search form display preferences....how do I only clear the checkboxes at the top of the form only and not at the bottom of the form between the <DIV> tags? I have attached a copy of the JSP page.

View 1 Replies View Related

Add Text To Current Selection

May 14, 2009

I have a function that will add text to the end of my text box. I want to be able to have the text added where it is currently selected.

My current code is :

View 1 Replies View Related

Wrapping A Selection With Text?

Jun 11, 2011

I am working on code to wrap BBCodes around a user selection, then leave the selection selected for possibly adding more BBCodes around the same selection.My problem is that there seems to be several different ways to do it and I can't figure out which one is "the best".Now, I can't use the "standard" way of doing this because I am working with TinyMCE. I know there are countless examples on how to do this with textareas... that is NOT what I need.TinyMCE can give me a selection RANGE, a selection NODE or a selection OBJECT. Note that if I use TinyMCE's range, it internally "normalizes" the range to be a standard W3C range, regardless of browser.I've created a new range, extracted the selection from the user's range, created elements for the open and close BBCode, inserted the elements into the range and finally set the user's selection to the new range. Works fine.

I also tried taking the selection node (which is an element), then simply used "innerHTML" to add the opening and closing tags, then set the node to the modified node. Works fine.I've also used the editor's built in "selection.getContent()" and "selection.setContent()" calls and THIS also works.I've even tried using the DOM "surroundContents()" function, then used a regex to change the < and > into [ and ]. Freaky... but that works too.So, my dilemma is... which method should I use???To recap, here's what I want (blue represents selected text):

This is a test sentence. (user selected some text)
This is a test sentence. (text is wrapped and remains selected).
This is a test sentence. (user clicked another bbcode button).

[code]....

View 6 Replies View Related

Get The Selection Of A Text With The Function?

Mar 27, 2010

im trying to get the selection of a text with the javascript function : window.getSelection();.

The problem is that the result is not like i hope. For example with a structure like this:

<div class="one" id="one">
Im one div
<strong class="two" id="two"> this is strong </strong>
Rest of div

[Code]....

View 1 Replies View Related

Get Text Selection In FireFox/Mozilla?

Sep 25, 2005

Can anyone give me a Javascript snippet that will get the currently selected
text in a TEXTAREA element? The code I have only works in IE.

View 1 Replies View Related

Unwanted Text Selection In MSIE?

Oct 13, 2011

I made up a little test program to grab the mouse X and Y coordinates and plan to use it to allow users to resize a window.

Anyway, the problem I'm having is that in MSIE-8, the mouse down and movement causes text to be selected (which I don't want).

Here's is a screenshot from MSIE:

[URL]

And here is the test program live online: [URL]

Notice that the text in the box is selected... I don't want that to happen.

Of course, it works just fine in Firefox, but not MSIE.

View 4 Replies View Related

Display Text From Checkbox Selection?

Sep 25, 2010

Is there a way to display text from selecting checkboxes such that different combinations have different texts?

View 2 Replies View Related







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