I want the user to be able to select the text in the div and add the <span style="color: #ff3300;"> to it.
Example code # http://jsfiddle.net/SkDA8/1/
Hover over to div and click on the missing picture to display the color-swatch
Thanks for your help!
PS
I want it to work in all modern browsers.
I was about to respond to your post to the Rangy group about this, but I'll respond here too.
This is one task that is achievable using document.execCommand():
document.execCommand("ForeColor", false, "#ff3300")
I've created an update to your jsfiddle: http://jsfiddle.net/timdown/SkDA8/3/
Not exactly certain what you are trying to do. Here is an updated jsFiddle that gets the value of the colored swatch that is clicked and updates the header color.
http://jsfiddle.net/SkDA8/4/
Hope this helps.
Bob
Related
Trying to build a guestbook with some jQuery features..
Now when im clicking at the "Post"box it appears a new box with the name "MenuBox" (This box is always hidden) i got the toggle part to work ALMOST.
The meaning of the MenuBox, is that it should show over the PostBox with a delete button so they can delete the post.
But now when i try to toggle it, it toggles all the boxes, is there a possible way of like making $("$(this) .MenuBox").click(
Anyone got any clue?
Sorry if the explanation is bad..
Provided that .MenuBox is a child of $(this):
$(this).find('.MenuBox').click(...);
I have a sharepoint webpart that shows some information from some lists, the lists are security trimmed, so if the user does not have permission to that list, it will show access denied. Which is fine.
I want to hide that part of the page.
I found how to solve it here:
http://www.timferro.com/wordpress/archives/227
This is the code I have:
<script src="/_layouts/Scripts/jquery1.8.1.min.js"></script><script language="javascript">
$("span:contains('Error')").hide();
$("div:contains('Access denied'):not(:has(div))").hide();</script>
And this is the screenshot that shows what I need to hide.
1
Better pic here
Update:
when I hide it, now sharepoint its showing me a blue line that I want to get rid off, but If I hide the blue line only, then a strange space will be between webparts, I think the best is to hide that TD that contains the rest of the things? How can I hide that?
Please see new screeenshot
looks like you forgot to put it inside the jQuery ready function:
$(function(){
$("span:contains('Error')").hide();
$("div:contains('Access denied'):not(:has(div))").hide();
});
Try below,
$(".UserGeneric span.ms-bold:contains('Error')").hide();
or If you want to hide the whole error then
$(".UserGeneric span.ms-bold:contains('Error')").parent().hide();
I wonder if someone could help me please. I have a picture inside a small HTML table within a main table and I need the small table to change background color when I click on a thumbnail. I want to have three thumbnails with three different colors.
Thanks a lot for your help. :)
Alina
Whilst i was waiting for you to add some code i've created some sample code showing how to change the colour on click using jQuery:
http://jsfiddle.net/Grhcm/
THis will do
$(document).function(){
$('table id ').click(function(){
$(this).css({background:'red'});
});
});
I'm trying to add details to a database by using ajax and table dynamic rows.
e.g.
----
{Customer: dropdown menu} | {Description: textarea} | delete
Add New Customer
---
When the user clicks it shows the drop down menu of all available customers. when you click away it just shows the select customer name (not the dropdown menu)
Similarly with the description i want on click to allow them to edit the description of the text area but when you click away it only shows the text you just entered. (not the text area outline)
Add new customer button creates a new empty row.
What libraries or examples can help me get started with this?
I saw this recently in an application recently. In this application it was possible to add new items/rows via ajax and dynamic HTML.
You should be able to do that easily enough using jQuery (look at the selectors, events & manipulation in their docs). For example, for the dropdown
<span id="customer-name"></span>
<select name="customer-list" id="customer-list">
<option class="name" value="cust-1">Frank Frankson</option>
<option class="name" value="cust-2">John Johnson</option>
</select>
And the jQuery :
$('.name').click(function(){
$('#customer-name').text($(this).text());
$('#customer-list').hide();
});
In that function you could do something with the option element value if needed (an ajax post or whatever).
The principal for changing the Text Area description would be the same (you could grab the text out of the textarea, add it to a div & hide the textarea; if they need to edit again, just show the textarea & hide the div)
Use jQuery.
Use the tokenizing autocomplete plugin for jQuery
For the inplace edit use Jeditable.
I'd stay away from drop downs, they are almost always bad design, whether in a menu or selecting from a long list of options. For something like a list of customers which is hopefully likely to be long it is an awful choice of a UI component.
The only time that it really makes sense to use a drop down is when the list of options is short and well known. So for it to be acceptable it probably has to be a list of options which rarely if ever changes, is less than 10 or so items long, and is used frequently (so it is well known). Drop downs are painful.
Most sites where you see such functionality accomplish it with styling - you can style a text input box to look like plain text (by removing the border and setting the background color to transparent). When the input is clicked on (focused), the style changes:
<style>
.blurredText { border: none; background-color: transparent; }
</style>
. . .
<input type="text" class="blurredText" value="Click me to edit"
onfocus="this.className=''"
onblur="this.className='blurredText'"/>
Styling a select the same way may prove difficult however, since select controls are notoriously resistant to CSS. You can still use the method Dave proposed.
I'm looking at creating something like this:
http://konigi.com/interface/kontain-search
alt text http://s3.amazonaws.com/konigi/interface/kontain-search-2.png
I don't suppose anyone has any resources which could guide me? I know I'm not giving much information but I wouldn't know where to start looking.
Cheers!
EDIT Sorry, I meant just the drop down / input box, nothing else on that site.
EDIT AGAIN The drop down list is inside of the input box, hence why I was wondering.
It may be something similar to these examples but with only one main item. and manipulate with jquery each "li" and that action taken
example 1 |
example 2 |
example 3 |
example 4
edition answer: this is done with css.
is all contained in a div -> input + menu.
for the input is removed border styles and background color is the same as the container div.
Well, you put part of the search form in a hidden div and pop it up when the user clicks or hovers on some other element, either inside or outside the form. Use CSS as needed to position the div. Not really sure what problems you could possibly have with something like this.
Maybe you can be more specific and break this problem down in several more focused questions?
I did not drill into the site, but from a logical standpoint, perhaps the search box AND the dropdown are "inside" another element (div?) that forms the complex control...and just formated(CSS)/actions(jQuery) placed on those.
<div id="searchDiv">
<div id="searchText"></div>
<div id="searchDropdown"></div>
<div id="searchButton"><div>
</div>
Easy enough to set somthing like that up.
I think what's going on there isn't that the dropdown is inside an input box, but rather that the input box chrome is hidden and it's placed inside an input-looking div along with the dropdown.