|
perhaps this is also very difficult to learn
|
|
|
|
|
is virtual world one of the most
|
|
|
|
|
<input id="rdo1" type="radio" name="rdoTest" value="Hello" />
<input id="rdo2" type="radio" name="rdoTest" value="World" />
<var id="test1" onchange="alert('2');">Test Value</var>
$(document).ready(function () {
$('[name=rdoTest]').change(function () {
$('#test1').text($('[name=rdoTest]:checked').val());
});
$('#test1').change(function () {
alert($('#test1').text());
});
});
My code here but nothing happened
|
|
|
|
|
|
The second event is triggered by the radio change, you can either place the alert in it or get it to trigger the second event, e.g.
<script>
$(document).ready(function () {
$('[name=rdoTest]').change(function () {
$('#test1').text($('[name=rdoTest]:checked').val());
$("#test1").trigger("change");
});
$('#test1').change(function () {
alert($('#test1').text());
});
});
</script>
Peter Leow
https://www.amazon.com/author/peterleow
|
|
|
|
|
Hello, I am modifying a web page with a lot of CSS code. There are many div tags. Mid-way on the page are div tags that enable a button to appear. I wish for this particular button to automatically click when the page loads. I have tried many combinations of JavaScript and JQuery but nothing so far works.
The button is defined by div tags comparable to this:
<div class="Btn-info">
<div class="Btn-btn active">
<strong>THE BUTTON</strong> <span></span>
</div>
...
</div>
I haven't yet figured out if the second div name is "Btn-btn active", or whether it is named "Btn-btn" and active is an attribute.
My efforts at coding either a JavaScript or JQuery way to automatically click the button I see on the page have not worked. I have tried these variations:
<script type="text/javascript">
jQuery(function () {
jQuery('.div.Btn-btn').click();
})
</script>
OR
<script type="text/javascript">
jQuery(function () {
jQuery('.Btn-btn').click();
});
</script>
OR
<script type="text/javascript">
jQuery(function () {
jQuery('.Btn-info.Btn-btn').click();
});
</script>
OR
<script type="text/javascript">
jQuery(function () {
jQuery('.Btn-btn active').click();
});
</script>
So far nothing works. Does anyone out there have an idea about how to make this work? Many thanks if you do.
|
|
|
|
|
$(window).load(function() {
$("div.Btn-btn active").click();
});
Keep in mind - hopefully there is a onclick defined for that "button" somewhere (click handler)
|
|
|
|
|
I changed the click statement to:
div.Btn-btn.active").click()
...And it works! Thanks so much for the help!!!
|
|
|
|
|
Hi all
i am creating gps tracking system
i have to do two things with the marker
1- create context menu with some functions on the marker
2- add car number as label on the marker
the first thing is finished
Map With Context Menu
when i tried to do the second issue a conflict (i think) happened
i included a JS library
Map Label Library
both are working alone but when combined no thin work
code after combine
Map With Labels and Context Menu
some details
both depend on overlay
errors
TypeError: a.lng is not a function
...b=b||new _.G(0,0);var c=this.b;b.x=c.x+a.lng()*this.j;a=_.Za(Math.sin(_.Sb(a.lat...
InvalidValueError: not a LatLng or LatLngLiteral: in property lat: not a number
TypeError: c.lat is not a function
...,c=d.b.search(_.vi)):(c=a.ca,c=new _.G(c.lat(),c.lng()),a.da=c,_.uJ(d.j,{da:c,ye...
InvalidValueError: not a LatLng or LatLngLiteral: in property lat: not a number
Thank You
|
|
|
|
|
Hey guys, I know the title is simple but I'm new to javascript and would appreciate if you could help me out
here's the deal,
I ve got some records that i read from database, and I want to add the to top of my table this is run every 20 seconds
var interval = setInterval(function () {
loadTableData(selectedOption);
}, 20000);
here's what's happening inside loadTableData function
function loadTableData(dataType) {
$.get("/JsonResultlink", null, function (result) {
var itemAdd;
$.each(result, function (i, item) {
loadRecordTimeOut = setTimeout(function () {
if (result[i].VEHICLEPLATE !== undefined) {
itemToAdd = generateRow(result[i], dataType);
$('.tto-violation-tablebody').prepend(itemToAdd);
checkRowCount();
}
}, 1000 * i);
});
clearTimeout(loadRecordTimeOut);
});
}
loadTableData is called in document ready and then every 2 seconds
Now I got 3 buttons that when each is clicked i call loadTableData with new dataType and show the result
now the problem is that in the middle of data being added to table i click one button I want the table to clear and the new data be displayed but what i get is that data loading becomes faster and i get both data from previous load and this load,
Please help me out and I'd like to learn clean coding so if you have any suggestions please let me know, appreciate it.
modified 5-Nov-16 6:59am.
|
|
|
|
|
You need to cancel your first periodic update when you change the table content. Read about it here[^]
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
I am new to the JavaScript ,I know how to pass data from one html page to another html page but i don't know how to pass data from one html page to multiple pages.. Can anyone help me
|
|
|
|
|
We can probably help you, but first you'll need to explain precisely what you're trying to do.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sir,
I had passed the values from one page to another page.But i don't know how to pass the values from one page to multiple pages.
|
|
|
|
|
You've already told us that in your previous post.
What you haven't told us is what you mean by passing to multiple pages.
It obviously means something to you, but the rest of us have no idea what you're talking about.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I had tried like this, passing the values from one page to another page
Below is my first page pass1.html
<html>
<head>
<script type="text/javascript">
function getParams()
{
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx !=-1)
{
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++)
="" {
="" console.log(pairs.length);
="" nameval="pairs[i].split('=');
" params[nameval[0]]="nameVal[1];
" }
="" return="" params;
="" }
params="getParams();
firstname" =="" unescape(params["firstname"]);
lastname="unescape(params["lastname"]);
age" unescape(params["age"]);
document.write("firstname=" + firstname + " <br="">");
document.write("lastname = " + lastname + " ");
document.write("age = " + age + " ");
</script>
</head>
</html>
Below is my second page pass.html
<html>
<form type=get action="pass1.html">
First Name: | <input type=text name=firstname size=10> | Last Name: | <input type=text name=lastname size=10> | Age: | <input type=number name=age> | <input type=submit value="Submit">
|
</form>
</html>
|
|
|
|
|
OK. But you still haven't explained what you mean by passing the data to "multiple pages".
If you don't tell us what you want to do, we can't help you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You can pass through posting, querystring, cookies, cache, localStorage, and probably etc, etc. You have to be way more clear as to what you want to do.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I am trying to add theme on my web pages on button click, but i am unable to do it.
Would you please tell me how to do it?
|
|
|
|
|
|
|
Thanks
|
|
|
|
|
|
If I am using an image of a paint brush with a clear background as my cursor image, is it possible to use Javascript to change its background color?
I would like to be able to select the background color of the cursor using a color picker.
I've been searching all over the web but haven't had much luck, please help.
|
|
|
|
|
I suggest you post the relevant code so we can see what you are doing and how you are doing it.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|