JQuery :: Get The Element That Received The Sortable?
Oct 19, 2009
I'm implementing a drag and drop newsletter, where my users can drag content to different areas of a template. Depending on where they drop the content, I need to add different HTML attributes to some of the code (essentially need to make the images float:left if they're dropped into a certain box). I've achieved a basic version of this using this code:
$('.review_list').sortable({
receive: function(event, ui) {
// somehow need to make this only apply to competition/
mainfeature
[Code].....
This adds align="left" vspace="4" hspace="4" onto any image dropped into an element with the 'review_list' class (I know I said it was float:left but this code will be emailed so I have to do it old school style...). Anyway: is there a way that I can get the element that has received the sortable item? It could be one of three in my case, and I only want this code to be added for two of them. I guess I could run a cleanup function when submitting that removed this addition for images in the other element, but this seems messier - I had assumed that the 'receive' event would return the receiving element.
View 1 Replies
ADVERTISEMENT
Dec 17, 2009
I have some sortable lists.
I need to be able to drag an element from on list to another but leave the original element in its list and have a copy in the new list.
I tried this;
But it treats el and elcone as the same element.
View 3 Replies
View Related
Jul 9, 2007
My script is the same as this http://www.w3schools.com/php/php_ajax_database.asp
When the data comes back to me its using
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
I get the data back fine. However inside getuser.php my data is in a sortable list. If i use this code above. My data comes back but I can no longer sort my list and move things around (I'm guessing because its returned as HTML only). Can anybody give me a solution of what i need to change so my list is also sortable again?
View 3 Replies
View Related
Nov 11, 2011
I'm using the jquery accordion in order to list all email received/sent. The header (h3+a) shows the object, the content (div) is the mail text.
HTML accordion :
<div id="accordion"><div>
<h3><a href="#">object 1</a></h3>
<div>mail 1 text</div>
</div><div>
<h3><a href="#">object 2</a></h3>
<div>mail 2 text</div>
</div>
<div>
<h3><a href="#">object 3</a></h3>
<div>mail 3 text</div>
</div>
</div>
Accordion script function:
$(function() {
$( "#accordion" ).accordion({
autoHeight: false,
header: "h3",
navigation: true
});
});
I would like to request my SQL database only when i clic on the header of a mail, and avoid to preload all the mails. The other problem, much important in my case, is to mark the mail "read" or "unread". There is a column in the SQL database for this. So, the mail needs to change to "read" state when I click on his accordion's header. Before using accordion, I was using simple link which reloads all the page. I've no problem with PHP/SQL, but I'm not so good in javascript/jquery, or ajax...
SQL request (simplified) :
$sql = "SELECT mail_object, mail_text FROM table_mail ";
$req = mysql_query($sql);
SQL update read-state (simplified) :
$sql_2 = "UPDATE table_mail SET mail_read=1 ";
$req_2 = mysql_query($sql_2);
So, is there any way to execute this code when I click on a header? After that, I'll asking you how to change header style to differentiate read/unread mail (in bold for example, or change background image/color).
View 1 Replies
View Related
Sep 17, 2009
I try to load only a part of my data file (named Elements.html).
[Code]...
View 6 Replies
View Related
Oct 22, 2009
I'm trying to parse a Json string received by $.getJSON(). I can receive the string but firebug gives me an "invalid label" error. I think it is because the string is an hash array with a number as first label, but I'm not sure. This is the string:
{"15":{"id":15,"x":0.4589937586135409,"y":
0.8324914620560137,"z":-0.9435707004102728,"rawData":"1256204002860 13
-442866538 18392602 647462767 314 1777206957 -1664784174 "}}
and this is the non-working code:
[Code]....
View 1 Replies
View Related
Aug 8, 2011
On clicking a thumbnail I'm getting it's corresponding image through $.ajax method. So, the data I receive is in the form of html string i.e. <img src="image/1.jpg"/>.
Now I wanted to append this data into a div which has an id "container". So I done this by:
$('#container').hide().append(data).fadeIn('slow');
I have a function named "resize" which resizes the image according to the window size. Now when i tried this:
// this code is in executed on success.
$('#container').hide().append(data);
resize( $('#container img') );
$('#container').fadeIn('slow');
I had to click a thumbnail twice to load the image into the container. I don't know why is it so. So, I tried a different route. I tried to apply resize function upon the <img> tag received as data and then append it to the container div.
Which I did like this:
resize ($(data)) //alerting $(data).attr('src') shows the src of the image.
$('#container').hide().append(data).fadeIn('slow');
The image loads but it is not re-sized. What should I do? The re-size function I'm talking about, u can see it here: [URL]. Right now, I'm calling the resize function in the callback of fadeIn method, the image fades in and then resizes, but that looks very ..... unprofessional and ugly.
View 1 Replies
View Related
Apr 5, 2009
I have hidden form field in a page. I populate it through JS and submit it.The problem is the data is text and it is really huge. The text is around 50000 chars.So when I submit the page no data is received at the backend. I do get the data if it is less i.e if I have few chars, I do get the data in the backend.I have the following Qs:
- - Is there a limitation in the number of characters JS can handle? If yes, What is the limit?
- - Is this happening cause the hidden form field is unable to hold the data? (I dont think this is the case as the other elements like textare etc can hold the data)
View 3 Replies
View Related
Oct 12, 2011
I am trying to find a way to get more than one characters pasted on html text field (input type=text), using onkeydown or onkeypress, I am NOT interested in onkeyup(it works), so please do not suggest me this solution. Also I am not interested in Jquery, I do not like to use it. I need solution to work with all browsers.
I am able to do that if you type one character, by taking the character of the event, but till now I am unable to get group of characters come from the paste (ctrl+V) or by mouse.You can look at Facebook search menu that shows auto complete results, it works on events: onkeydown and onkeypress and you notice that you get the result before you release your finger, try to paste something (more than one character) and you get the result before releasing finger, how? Onkeypress and onkeydown do not show first thing you paste or type because they happen before the text being added to text field.
Code:
<input type="text" id="targetTextField" onkeydown="CapturePastedString(this.id)" /> <script> function CapturePastedString(id){ var targetTextField=document.getElementById(id); // below I need to capture the pasted string like: var pasted_string= function(){.....} targetTextField.value=pasted_string; } </script>
View 4 Replies
View Related
May 24, 2009
I need to parse an HTML string received from an AJAX request. I wrote a function that places the HTML string into an unappended (not added) <div> , which opens the string up to the DOM hierarchy. However, when I try to access the elements of this <div> , I get an error in the console that says root.getElementById is not a function. This tells me that I can't access any of the child nodes.
Here is what my script looks like:
function parseHTML(html) {
var root = document.createElement("div");
root.innerHTML = html;
// The error console stops at this line
[Code]...
View 5 Replies
View Related
Oct 23, 2009
I'm trying to write code where an ajax function, at a specified interval, calls php script to query a table and open a certian window according to the response(variable) received. After that, the ajax function will continue to call the same php script but will open another window only if the response or variable is different from the previous request(s). What kind of method should I use to achieve this?
View 7 Replies
View Related
Jan 13, 2011
i am new to Html and i am helping run a website for virtual golf. we were thinking of adding a Statistics page but would need the table used to be sortable so by hitting the header the column sorts the figures in order, the tablw would only be 50 rows and 8 columns. i have looked at the website [URL]../docs/but cant seem to sort out where to place things. a step by step guide would very much be appriciated.
View 6 Replies
View Related
Oct 21, 2011
Anyone had any luck getting sortable working correctly in IE9?
[URL]
I don't see anything in the bug tracker regarding this, anyone else experience this? Anyone have 5 seconds to fire up IE9 and try the above demo?
View 5 Replies
View Related
Feb 12, 2010
I am reciving the (ajax) response res and diplaying in <div id=homepage> , i want to know is there any way to call a js function after i have recived/displayed the reponse inside <div id=homepage> .
View 1 Replies
View Related
Mar 3, 2011
How to add a draggable to sortable programatically ?
<script>
$(function() {
$( "#sortable" ).sortable({
revert: true
});
});
[Code]....
In the above code i have a list of sortables, i want to add the draggable($obj) to a sortable, even though i add to the sortable in the add method, that gets added but does not play as a draggable,Do i need to call any method of sortable after adding the draggable ?
View 3 Replies
View Related
Aug 3, 2009
have such a structure in HTML which finally looks like shown on this
[Code]...
View 5 Replies
View Related
May 14, 2009
its an accordion like tool. It functions just how Ineed it, except id love to make it sortable.with the codeupdate?jQuery :
$(function() {
$("#accordion1").addClass("ui-accordion ui-widget ui-helper-reset")
.find("h3")
[code]....
View 1 Replies
View Related
Sep 15, 2009
I'm trying to place a sortable list inside an accordion and it isn'tworkig. The list appears outside, below the accordion.
View 2 Replies
View Related
Apr 29, 2010
I'm working on a project and got stuck on this tiny script
I load some data from a file and I put in one div:
function getloadedfile (fileurl){
$.ajax({
url : fileurl,
dataType: "html",
[Code].....
The sortable only works then I don't load it as aseparatefile
View 4 Replies
View Related
Nov 10, 2011
I've take the standard Demo code from 'm trying to make the images within the Trash container sortable.Despite attempts for the last couple if hours and a number of different combination, I'm still unable to get it working
View 2 Replies
View Related
May 11, 2010
<ul
id
=
[code]...
View 4 Replies
View Related
Aug 9, 2010
In my design for admin panel, i wanna drag and drop modules. i have a php array with module names, and i need to save them sql like this[code]...
i can list right and left, but when i drag and drop something from one to another, it's not working.
is there any way to do that in jquery? can i get the information about where is the < li > ? how or where can i get the "where" columun?
View 2 Replies
View Related
Jul 23, 2009
I have 2 sortable lists, #pieces and #grid. I want to drag items from #pieces and add them to #grid without removing them from #pieces. That way I could add any number of any item in #pieces to #grid. The current code i have is:
<script type="text/javascript">
$(function() {
$("#peices, #grid).sortable({
connectWith: '.column'
[Code]....
View 1 Replies
View Related
Feb 17, 2011
i have the following code to get the change of position, I dont know how to make the list tell me the position of aspecific elementwhen i click it.
[Code]...
View 2 Replies
View Related
Jul 3, 2009
i am trying to use jquery UI sortable on my webpage to displaytoolbars. what i want is, let people sort these toolbars in the waythey like. i have named toolbars with id "1","2","3","4", and i savedsorted order to database via toArray method. i was wondering how icould display these toolbars with new order when people browser mysite next time, is there any method that supports it?
View 4 Replies
View Related
Nov 2, 2010
I'm new to this jquery and still learning, i having a question on how to make sortable list draggable? For e.g drag a list from sortable list to droppable zone and drop it, after drag or drop the list will back to sortable list.
View 2 Replies
View Related