I am creating a tab control using Ul and Divs. Ul is used to display the tab heads. When the user selects one Tab (ie , 'Li') ,the tab back color get changed with respect to others.
I want to get the Selected and not selected li in that Ul .
I used
$(".tab li:selected").css("background-color","red");
$(".tab li:deselected").css("background-color","white");
It 's not working, I know the code does not work .just guess it.
Now may you understood my problem,right?
//this is a code in php which is fetch a record from database
<?php
include("dbconn.inc");
$data=mysql_query("SELECT `subtitle`, `mian-title`, `page_num`, `note_path`, `flash_path` FROM `main-page` WHERE `page_num` =".$r." LIMIT 1");
echo $data;
if (mysql_num_rows($data) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
while ($row = mysql_fetch_assoc($data))
{ echo $row['page_num'];
}
include("close.php");
?>
//and this is a code in html
<form method="post" action="data.php">
<input name="Button1" type="submit" value="<<" />
<input name="test" style="width: 31px; height: 23px" type="text" /> // this is a value of page_num in DB.
<input name="Button2" type="submit" value=">>" >
</form>
//i want to add an ajax code to retrieve the record from php code, and then change the input values depends on returned data ,and also to prevent refreshing the page always!!
I have a basic html page generated through php and it prints to a printer after a link click using Ben Nadel's print plugin. However, I don't want the user to print the page again. I tried setting the 'print' link to a negative z-index using jquery after it's being clicked, but the user can refresh the page and reuse the link so it would print again. I also know that I can somehow disable the refresh feature, by modifying what F5 does, but that would't save the day since the user can refresh the page through the url bar, and I can't remove/hide, it as much as I know. It also runs on localhost so the user client and server are on the same side. Even the browser doesn't matter since I could use the one that fits this case.
I am having trouble passing data retrieved from a $.post() function to use in other places in my code. I want to save the data as a variable and use it outside of the post() function. This is my code:
var last_update = function() {
$.post('/--/feed',
{func:'latest', who:$.defaults.login},
function($j){
_j = JSON.parse($j);
alert(_j.text); // This one works
});
}
alert(_j.text); // This one doesn't
};
last_update(); //run the function
Please help!
I have this code for displaying content for login and registration in my PHP file:
<?php // LOGIN PART ?>
<div class="login-part"></div>
<?php // REGISTRATION PART ?>
<div class="registration-part"></div>
And this in my js file:
$(document).ready( function() {
// FOR REGISTRATION
$('span.logreg.reg').click(function () {
$('div.registration-part').append('<p>Registration</p>');
});
// FOR LOGIN
$('span.logreg.log').click(function () {
// insert html
$('div.login-part').append('<p>Login</p>');
});
});
Now, everytime I click on a span it shows the text login or registration, according to which of the span was clicked.
Thats OK, however I need to add it only once, so when the user click more times on the span it will be not adding more text.
Remove() or empty() is not an option, as far as I know, because I need the information inside input boxes (there will be input boxes later for inserting user info) to stay there and not be deleted if the user click accidentally on the span again.
It can however delete the html inside the div, if he clicks on another span. E.g. if span.log is active, after clicking on span.log nothing happens, but if he clicks on span.reg the html inside div.login-part will be removed and registration text will appear.
How to do something like this?
Hi,
I want to be able to search a list of full names. The autocomplete demos I have seen have all searched from the beginning. Thats no good as I want matches on surname too.
I can live without full text search if it at least follows word boundaries. Sorta like the tag search here. Hows that done?
Cheers
I am using this:
var title = $('#input').val();
$('#titleset').click(function (){
$('#title').html('<h1>' + title + '</h1>');
alert(title);
});
to try to get the value of an input box and then when the user clicks the button #titleset, overwrite the value from the input box to the <h1> element that is already there.
i have been able to get the click to overwrite the <h1> element, but there is nothing in the title variable to write into the element. so how could i return a string from the #input id and write it to the #title id which is an <h1> element
here is my html
<h1 id="title">This Title Changes To What You Want It To Be</h1>
<ul class="menu1">
<li>menu one
<ul>
<li id='inputbox'><input type ="text" id="input"/></li>
<li id="titleset1"><input type="button" value="set title" id="titleset"/></li>
</ul>
</li>
</ul>
I'm trying to add a row to a table and have that row slide into view, however the slidedown function seems to be adding a display:block style to the table row which messes up the layout.
Any ideas how to work around this?
Here's the code:
$.get('/some_url',{'val1':id},
function(data){
var row = $('#detailed_edit_row');
row.hide();
row.html(data);
row.slideDown(1000);
});
I can't seem to figure out this problem. I am trying to get xml to render html tags. The problem I am having using .text() will display but not recognize any html tags. If I use .html() or just call var long2 = $(this).find('long'); nothing will show up in Safari or IE.
I have xml paragraph
I have text in here that needs bold tags or tags which is why i need html tags in the xml to be recognized.
Code:
$(document).ready(function(){
$.ajax({
type: "GET",
url: "xml/sites.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('site').each(function(){
var id = $(this).attr('id');
var title = $(this).find('title').text();
var Class = $(this).find('class').text();
$('<div class="'+Class+'" id="link_'+id+'"></div>').html('<p class="title">'+title+'</p>').appendTo('#page-wrap');
$(this).find('desc').each(function(){
var url = $(this).find('url').text();
var long = $(this).find('long').text();
$('<div class="long"></div>').html(long).appendTo('#link_'+id);
$('#link_'+id).append('<a href="http://'+url+'">'+url+'</a>');
var long2 = $(this).find('long');
$('<div class="long2"></div>').html(long2).appendTo('#link_'+id);
});
});
}
});
hi_all()
I have a problem with parsing http response.. I try send some values to client
>>>>return HttpResponse(first=True,second=True)
when parsing:
$.post('get_values',"",function(data){
alert(data['first']); //The alert isn't shown!!!
});
what is the right way to extract values from httpresponse
maybe I make a mistake when create my response..
I am implementing the highlight procedure of line .
If the user click the checkbox it will highlight whole line by yellow. User can make as this any number of line. So it is possible to highlight the whole line when user click the checkbox?
Please check my picture I select all text when I click the checkbox (because you will understand my problem)
I am trying here in this fiddle
<div>
<button id="next">next
</button>
<button id ="previous">previous
</button>
</div>
Checked rows: <span id="checkedRows"></span>
<div id="content">
<div id="left">
<div class='cb'>
<input type="checkbox" />
</div>
</div>
<div id="realTimeContents" class="left realtimeContend_h"></div>
</div>
I have a WebView that loads HTML that contains an <embed>. When loading in stock android (G1, NexusOne, Ion, etc) it looks fine and can be clicked on to watch it in the YouTube app. But when loading it using either the HTC EVO or Incredible (both Sense UI phones ) the space where the content should be is completely blank.
Try this code below... Any ideas? I'm stumped. Certainly looks like an HTC Sense bug?
WebView wv = (WebView) findViewById(R.id.wv1);
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setBuiltInZoomControls(true);
wv.getSettings().setPluginsEnabled(true);
wv.loadData("Here is the test embed: ", "text/html", "UTF-8");
In my testing, this will run fine on all Android versions, without SenseUI, but it shows blank for what looks like any SenseUI phone, so the user can't click on it.
info = {'phone_number': '123456', 'personal_detail': {'foo':foo, 'bar':bar}, 'is_active': 1, 'document_detail': {'baz':baz, 'saz':saz}, 'is_admin': 1, 'email': '[email protected]'}
return HttpResponse(simplejson.dumps({'success':'True', 'result':info}), mimetype='application/javascript')
if(data["success"] === "True") {
alert(data[**here I want to display personal_detail and document_details**]);
}
How can I do this?
I am stuck with a kind of bug in FF, wherein it’s unable to load images of big size (I have 8 MB size of image) from the server. The loading of image is all fine on IE. I am still looking out for ways to get rid of this problem.
I changed server(IIS) settings to allow bigger file sizes. Also, I used “load” event on image using JQuery and tried all sort of options listed here http://api.jquery.com/load-event/, but nothing worked so far. If anyone of you has come across any such similar problem, and a way to resolve it, it would be nice to hear from you
Please note: high resolution images are part of the requirement.
Code :
<style>
img {
background-color: #FFFFFF;
background-image:
url(http://eremurus.hyd:8080/QMS/plugin/imagepanner/loader.gif);
background-repeat: no-repeat;
background-position: center center;
}
</style>
<script src="../plugin/jquery-ui-1.8.7.custom/js/jquery-1.4.4.min.js"
type="text/javascript"></script>
<script>
jQuery(document).ready(function($){
///var _url = "http://eremurus.hyd:8080/QMS/plugin/imagepanner/floorPlan.jpg";
// set up the node / element
_im =$("#main");
//_im.bind("load",function(){ $(this).fadeIn(); });
// set the src attribute now, after insertion to the DOM
//_im.attr('src',_url);
$("#main").one("load",function(){
alert('loaded');
})
.each(function(){
if(this.complete){
$(this).trigger("load");
}
});
});
</script>
</head>
<body>
<div id="target"><img id='main' src="http://eremurus.hyd:8080/QMS/plugin/imagepanner/floorPlan.jpg"> </img></div>
</body>
</html>
I'm playing around with jQTouch for an iPhone OS app that I've been toying with off and on for a while. I wanted to try my hand building it as a web app so I started playing with jQTouch. For reference, here is the page+source (all my code is currently in index.html so you can just "View Source" to see it all):
http://rpj.me/doughapp.com/wd/
Essentially, I'm trying to save pertinent JSON objects retrieved from Google Local into DOM objects using the data() method (in this example, obj is the Google Local object):
$('#locPane').data('selected', obj);
then later (in a different "pane"), retrieving that object to be used:
$('#locPane').bind('pageAnimationEnd', function(e, inf) {
var selobj = $(this).data('selected');
// use 'selobj' here ...
}
In Chromium and Safari on the desktop OS (Snow Leopard in my case), this works perfectly (try it out).
However, the same code returns undefined for the call to $(this).data('selected') in the second snippet above. I've also tried $('#' + e.target.id).data('selected') and even the naive $('#locPane').data('selected'). All variants return undefined in the iPhone OS version of WebKit, but not on the desktop.
Interestingly, the running this on Mobile Safari in the iPhone Simulator fails as well.
If you look at the full source, you'll see that I even try to save this object into my global jQTouch object (named jqt in my code). This, too, fails on the mobile platform.
Has anyone else ever ran into this? I'll admit to not being a web/javascript programmer by trade, so if I'm making an idiot's error please call me out on it.
Thank you in advance for the help!
-RPJ
Update: I didn't make it clear in the original post, but I'm open to any workaround if it works consistently. Since I'm having trouble storing these objects in general, anything that allows me to keep them around is good enough for now. Thanks!
Hi,
on a website i'm currently developing I'm using jquery to do all sort of magic things :-)
In firefox however, when I load jquery 1.4.2 there are sometimes funny characters in front of the request.
You can see the strangers characters in this screenshot (thank you firebug).
In safari, Chrome and IE these funny characters don't appear, jquery is loading fine in those browsers.
Why are those characters appearing and how can I remove them?
Thanks!!
I'm trying to iterate a bunch of SELECT OPTION html drop-down fields and from the ones that are NOT empty, take the values and add a hidden field for a PAYPAL shopping cart.
My problem is that for some reason, the variable "curitem" is not passed inside the each function and I can't add the hidden field like they should. All I get is "NaN" or "undefined".
What PAYPAL expect is : item_name_1, item_name_2, etc. All numbers must iterate by +1.
How can I do this?
Thanks a bunch in advance
var curitem;
$.each($("select"), function(index, item) {
var attname = $(this).attr("name");
var nom = $(this).attr("data-nom");
var prix = $(this).attr("data-val");
var partname = attname.substring(0, 1);
var qte = $(this).val();
// i want all my <select option> items that the NAME start with "q" AND have a value selected
if (partname == "q" && isNaN(qte) == false && qte > 0) {
// item name
var inp2 = document.createElement("input");
inp2.setAttribute("type", "hidden");
inp2.setAttribute("id", "item_name_"+curitem);
inp2.setAttribute("name", "item_name_"+curitem);
inp2.setAttribute("value", nom);
// amount
var inp3 = document.createElement("input");
inp3.setAttribute("type", "hidden");
inp3.setAttribute("id", "amount_"+curitem);
inp3.setAttribute("name", "amount_"+curitem);
inp3.setAttribute("value", prix);
// qty
var inp4 = document.createElement("input");
inp4.setAttribute("type", "hidden");
inp4.setAttribute("id", "quantity_"+curitem);
inp4.setAttribute("name", "quantity_"+curitem);
inp4.setAttribute("value", qte);
// add hidden fields to form
document.getElementById('payPalForm').appendChild(inp2);
document.getElementById('payPalForm').appendChild(inp3);
document.getElementById('payPalForm').appendChild(inp4);
// item number
curitem = curitem + 1;
}
});
I am trying to create a preview window for my texteditor in my blog page. I need to send the content to the server to clean up the text entered before I can preview it on the preview window. I was trying to use
$.ajax({
type: method,
url: url,
data: values,
success: LoadPageCallback(targetID),
error: function(msg) {
$('#' + targetID).attr('innerHTML', 'An error has occurred. Please try again.');
}
});
Whenever I tried to click on the preview button it returns an XMLHTTPRequest error. The error description -
Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case.
The ValidateRequest for the page is set to false.
Is there a way I can set validaterequest to false for the ajax call.Please advise
Thank you for reading my post.
Is it possible to have a textarea with max length in html so that the max length will not be exceeded even when pasting text? I have yet to see anyone implement this correctly, being able to handle the paste event when right-clicking and selecting paste.
I want to reference an element once and then reuse it threw out my code but I'm not sure the correct way. Below is what I tried but it only works in some places.
$(document).ready(function() {
var image = $("#content img");
image.wrap("<span />"); // Works!
image.hover(function(){}, function(){}); // Does not work?
});
Hello everyone.
I have the following code
$(document).ready(function() {
$("#myTextArea").focus(function() {
$("#myTextArea").animate({ "height": "75px"}, "normal");
return false;
});
to expand a textbox when it gets focus. The expand occurs, however the blinking cursor disapears, at least in Firefox!
Edited: The textarea is still focused, and i can type on it.
Why does this happen? Is there a way to show it again?
Thanks in advance
I want to make a few divs on the same page work similar to iframes. Each will load a URL which contains links. When you click on those links I want an AJAX request to go out and replace the div's html with new html from the page of the clicked link. It will be very similar to surfing a page inside an iframe.
Here is my code to initially load the divs (this code works):
onload:
$.ajax({
url: "http://www.foo.com/videos.php",
cache: false,
success: function(html){
$("#HowToVideos").replaceWith(html);
}
});
$.ajax({
url: "http://www.foo.com/projects.php",
cache: false,
success: function(html){
$("#HowToProjects").replaceWith(html);
}
});
This is a sample of code that I'm not quite sure how to implement but explains the concept. Could I get some help with some selectors(surround in ?'s) and or let me know what is the correct way of doing this? I also want to display a loading icon, which I need to know where the right place to place the function is.
$(".ajaxarea a").click(function(){
var linksURL = this.href; //
var ParentingAjaxArea = $(this).closest(".ajaxarea");;
$.ajax({
url: linksURL,
cache: false,
success: function(html){
$(ParentingAjaxArea).replaceWith(html);
}
});
return false;
});
$(".ajaxarea").ajaxStart(function(){
// show loading icon
});
i want to remove the id attribute from this image:
<img width="270" class="thumb" id="thumb" height="270" src="img/1_1.jpg" />
i tried doing this:
$('img#thumb').RemoveAttr('id','none');
but its not remving it!
thanks
EDIT:
$('img#thumb').attr('src', response);
$('img#thumb').attr('id', 'nonthumb');
this deosnt load the picture, or in this case the src!! but when i remove the id attribute, it works fine