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]...
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:
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; }}}
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.
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?
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.
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:
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
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.
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>
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.
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.
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 ?
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:
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.
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).