Basically looking for a JQuery plugin with better Android browser support than JQTouch. Or even an alternative Javascript framework with better mobile support.
Hello,
Is it possible to convert html tags to html entities using javascript/jquery using any way possible such as regex or some other way. If yes, then how?
Example:
<div> should be converted to <div>
I'm playing around with html5 and some javascript to make a minor sketchpad. Whenever I click down on the canvas in chrome, the cursor becomes a text cursor. I have tried putting cursor: hand in the css, but that doesn't seem to work. This has got to be an easy thing, but I look it up and can't find it anywhere
I have link that calls a function when clicked:
<a href="javascript:spawnMenu(this);" id="link1">Test1</a>
To make my function work, I need access to the object so that I can perform jQuery operations like this:
alert($(objCaller).offset().left);
Since objCaller points to the object and not the object ID, this won't work. I need something like this:
alert($("a#link1").offset().left);
How can I get the object ID from objCaller?
I'm using the jQuery validate() plugin for some forms and it goes great. The only thing is that I have an input field that requires a special validation process. Here is how it goes:
The jQuery validate plugin is called in the domready for all the required fields.
Here is an example for an input:
<li>
<label for="nome">Nome completo*</label>
<input name="nome" type="text" id="nome" class="required"/>
</li>
And here is how I call my special function:
<li>
<span id="sprytextfield1">
<label for="cpf">CPF* (xxxxxxxxxxx)</label>
<input name="cpf" type="text" id="cpf" maxlength="15" class="required" />
<span class="textfieldInvalidFormatMsg">CPF Inválido.</span>
</span>
</li>
And at the bottom of the file I call the Spry function:
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1","cpf");
//-->
</script>
Of course I call the Spry CSS and JavaScript files in the head section as well as my special-validate.js.
When I just use the jQuery validate() plugin and click on the send button, the page goes automatically back to the first mistaken input field and shows the error type (not a number, not a valid email etc.).
But with this new function, this "going-back-to-the-first-mistake" feature doesn't work, of course, because the validate() function sees it all good.
I already added a rule for another form (about pictures upload) and it goes like this:
$("#commentForm").validate({
rules: {
foto34: {
required: true,
accept: "jpg|png|gif"
}
}
});
Now my question is, how can I add the special validation function as a rule of the whole validation process?
Here is the page to understand it better: link text and the special field is the first one: CPF.
I hope I was clear explaining my problem.
I am trying to change the innerHTML of a div on the page that I am loading.
This is my JavaScript code:
function redirect(titleName){
window.location = "pageToLoad.php";
document.getElementById("title").innerHTML = titleName;
}
It doesn't seem to be working, please help me!!
When we apply $().dialog() in an object, jquery-ui puts it inside a <div class="ui-dialog ui-widget">, with a <div class="ui-dialog-titlebar ui-widget-header"> before it.
After the creation of this dialog around the main object, how can we get that ui-dialog object so that we can execute other JavaScript commands in it?
The best I could do was use .parent(".ui-dialog") in the main object, is there a better way to do it?
Hi guys! Tried to make a little old school ajax (iframe-javascript) script. A bit of mootools is used for DOM navigation
Description:
HTML:
1 iframe called "buffer"
1 div called "display"
JAVASCRIPT: (short: copy iframe content into a div on the page)
1) onLoad on iframe triggers handler(), a counter makes sure it only run once
(this is because otherwise firefox will go into feedback loop. What i think happens: iframe on load handler() copyBuffer change src of iframe , and firefox takes that as an onload again)
2) copybuffer() is called, it sets src of iframe then copies iframe content into div, then erases iframe content
THE CODE:
count=0;
function handler(){
if (count==0){
copyBuffer();
count++;
}
}
function copyBuffer(){
$('buffer').set('src','http://www.somelink.com/');
if (window.frames['buffer'] && $('display') ) {
$('display').innerHTML = window.frames['buffer'].document.body.innerHTML;
window.frames['buffer'].document.body.innerHTML="";
}
}
problems:
QUESTION 1) nothing happens, the content is not loaded into the div. But if i either:
A) remove the counter and let the script run in a feedback loop: the content is suddenly copied into the div, but off course there is a feedback loop going on, you can see it keeps loading in the status bar.
OR
B) insert an alert in the copyBuffer function. The content is copied, without the feedback loop.
why does this happen?
QUESTION 2) The If wrapped around the copying code i got from a source on the internet. I am not sure what it does? If i remove it the code does not work in: Safari and Chrome.
Many thanks in advance!
UPDATE:
Like the answers said i have created an event handler. They used jQuery, i have made one in mootools:
window.addEvent('domready', function() {
$('buffer').addEvent('load', function(){
$('display').set('html',window.frames['buffer'].document.body.innerHTML)
window.frames['buffer'].document.body.innerHTML="";
}).set('src','somelink');
});
Bonus question:
3) Im new at stackoverflow (what an amazing place!), is it better if i make new threads for follow up questions?
Is it possible to detect if a visitor is on the index page or domain root with client side scripting?
I figure javascript would be the best method as I would like to append a value to an image file based on wether a visitor is on the home page or not.
Non-index page:
<img src="/img/logo.png" />
Index page:
<img src="/img/logo-home.png" />
I am trying to use marker.setIcon() to change a markers image. However it appears that although this changes the marker.iconUrl attribute the icon itself is using marker.proprietary_marker.$.icon.image to display the markers image - so the markers icon remains unchanged. Is there a way to dynamically change the marker.proprietary_marker.$.icon.image?
Add a marker.
Check the icon's image url and the proprietary icon's image - they're the same.
Change the icon.
Again check the Urls. Now the Icon Url has changed but the marker still shows the old image which is in the proprietary marker object.
<head>
<title>Map Test</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=Your-Google-API-Key" type="text/javascript"></script>
<script src="mapstraction.js"></script>
<script type="text/javascript">
var map;
var marker;
function getMap(){
map = new mxn.Mapstraction('myMap','google');
map.setCenterAndZoom(new mxn.LatLonPoint(45.559242,-122.636467), 15);
}
function addMarker(){
marker = new mxn.Marker(new mxn.LatLonPoint(45.559242, -122.636467));
marker.addData({infoBubble : "Text", label : "Label", marker : 4, icon: "http://mapscripting.com/examples/mashups/richter-high.png"});
map.addMarker(marker);
}
function changeIcon(){
marker.setIcon("http://assets1.mapufacture.com/images/markers/usgs_marker.png");
}
function showIconURL(){
alert(marker.iconUrl);
}
function showProprietaryIconURL(){
alert(marker.proprietary_marker.$.icon.image);
}
</script>
</head>
<body onload="getMap()">
<div id="myMap" style="width:627px; height:412px;"></div>
<div>
<input type="button" value="add marker" OnClick="addMarker();">
<input type="button" value="change icon" OnClick="changeIcon();">
<input type="button" value="show icon URL" OnClick="showIconURL();">
<input type="button" value="show proprierty icon URL " OnClick="showProprietaryIconURL();">
</div>
</body>
</html>
while coding javascript and ajax, there is no proper documentation for this function?
i searched this term using api src="http://www.google.com/jsapi " and searchControl.execute("abhilashm86");
how does this google.setOnLoadCallback(initalize) called internally? is this function just for a new search term when user clears previous search and starts new one?
How exactly this google.setOnLoadCallback(initalize) gets trigerred?
Hi
How to format a textbox like "0.00" using Jquery or Javascript...If i enter value 59,then it should become 59.00.If i enter value as 59.20,then it should same....How it possible ....
Hi,
Is it possible to refresh parent page from child's child page using javascript.
I have a webform which opens a child window, a button on child window closes the present child window and opens a subchild window. Now a button on subchild should close the window and refresh the parent form.
Please suggest me the way of doing it.
Thank You.
I'm trying to open simple vector graphics using Raphaël JS and I can't find any converter that would do the whole job.
Is there any way to transfer vector graphics (SVG or anything from Illustrator, Inkscape) into Raphaël's JavaScript?
I have a main form, which has button. By clicking on this button JQuery Dialog will shown. And contains of this dialog is a javascript bing map (using VEMAP object). So there are different js documents.
How can I create a context menu for bing map, opening in jquery dialog?
Thanks!
hello...i have a problem with my project..i want to use barcode scanner for input data to textfield (i'm using jquery). this barcode scanner read serial number and model name of each product..but after scan, serial number and model name appear in one textfield. how to make them appear separately into different text field..first textfield for serial number and second textfield for model name...
is there some code to make it??use ajax,javascript or something else??
I'm looking to create a custom date picker with code examples from several sources.
Is the code to display/hide an ASP.NET control when a user clicks a button usually done with JavaScript or ASP.NET code?
Please provide a simple example. (If ASP.NET, VB example preferred over C#)
I want to run a local exe in my firefox extension javascript file, but ActiveXObject("WScript.Shell") is work fine in IE,not in FF,how to run a local exe in js in firefox.
I want to debug a javascript file that is embedded in the HEAD element.
I navigate to the site, see the code, and make a breakpoint:
But when I click on Reload, the script disappears and it doesn't stop at the breakpoint:
Debugging was working earlier so I know it works in general. What do I have to do so that Firebug always debugs my script?
Hi
What is the recommended way to transfer files via FTP and manage (rename, move, delete) files in an FTP server programmatically in a Windows Scripting Host script file (JavaScript/VBScript)? Preferably without requiring 3rd party ActiveX add-ons since these "extra" software will need to go through an approval process that will take a very long time, even for free (as in beer) and/or open source components.
The script is going to be run in a Windows 2003 Server in data center environment.
Thanks.
In javascript on a browser, I can do this to see if an object is DOM-related:
obj instanceof Node
How do I accomplish this with google desktop? Node is undefined, and this doesn't work either:
obj instanceof basicElement
I'm searching to select a text from a div, then click on a bookmarklet that remove all html parts in the body except the div where the text is selected
maybe jquery can help with something like :
javascript:var%20s=document.createElement('script');s.setAttribute('src',%20'http://jquery.com/src/jquery-latest.js');document.body.appendChild(s);s.onload=function(){/*the code*/};void(s);
What bad things happen at the moment document.write() is invoked?
I've heard bits and peices about document.write having an adverse impact on the DOM or on the use of Javascript libraries. I have an issue in front of me that I suspect is related, but have not been able to find a concise summary of what damage the method does.
Im trying to close a child window with javascript and in firefox everything works fine but in chrome the window doesnt close
here is what im using
$(document).ready(function() {
if (window.opener && !window.opener.closed)
window.opener.location = "http://www.website.com"
window.close();
});
I tried a suggestion on google, but to no avail.
Anyone having a similar issue or know of a work-around?
I have a set of data in one JSON structure:
[[task1, 10, 99],
[task2, 10, 99],
[task3, 10, 99],
[task1, 11, 99],
[task2, 11, 99],
[task3, 11, 99]]
and need to convert it to another JSON structure:
[{
label: "task1",
data: [[10, 99], [11, 99]]
},
{
label: "task2",
data: [[10, 99], [11, 99]]
},
{
label: "task3",
data: [[10, 99], [11, 99]]
}]
What's the best way to do this with javascript/java?