jQuery multiple selectors, get which selector triggered event

When handling events with multiple selectors, such as: $(‘.item a, .another-item a’).click(function(e) { }); Is it possible to determine which parent selector triggered the event? Was it .item or .another-item ? Thank you!

correctly resetting a global variable in javascript?

so, in this post here people are discussing the fact that A = [1,2,3]; and then doing A = []; will not reset the array but create a new one. My question is, if I use a global object variable myglobals = { A : [] } Can I safely reset the array with myglobals.A […]

Checking if CKEDITOR is defined or not

I use one function to call an ajax script from two different pages. The first and original page had CKEDITOR library defined and included and it work perfectly however, page 2 is like a mini version of page one and there is no ckeditor support here so i wanted a simple way of cheking if […]

How to define a variable in JavaScript with PHP echo function?

How do I define a variable in javascript with echo function, from the external php file? We have theconfigfile.php, thejsfile.js and thephpfile.php. In theconfigfile.php we have: <?php $path = ‘http://example.com/home.php’; // Set your path ?> In thejsfile.js we have: … if (confirm(“Are you sure you want to delete”)) { $.ajax({ type: “POST”, url: “http://example.com/home.php”, data: […]

How to select a div with specific css property

//style .TemplateBox1{display:none;} //Html <div class=”TemplateBox1″ id=”9″> 1 </div> <div class=”TemplateBox1″ id=”10″> 2 </div> <div class=”TemplateBox1″ id=”11″> 3 </div> //jQuery $(‘div’, this).each(function (e) { //Do something }); This is a part from my code, at start the divs display (CSSproperty) is none (not shown) and after the user click on a certain button the property of […]

Javascript check all and uncheck all for checkbox

<script type=”text/javascript”> function checkAll(formname, checktoggle) { var checkboxes = new Array(); checkboxes = document[formname].getElementsByTagName(‘input’); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].type === ‘checkbox’) { checkboxes[i].checked = checktoggle; } } } </script> <form name=”myform”> <li> <label class=”cba”> <a href=”javascript:void();” onclick=”javascript:checkAll(‘myform’, true);”>Check All</a> | <a href=”javascript:void();” onclick=”javascript:checkAll(‘myform’, false);”>UnCheck All</a> </label> </li> <li> […]

onclick window.location.href with input value

I have an input and I want the user to be sent to another page with the input’s value in the URI so that I can extract it. This is how my input is set up: <input name=”date” id=”datepicker” onchange=”window.location.href = ‘test.php?Date=’ + document.getElementById(“datepicker”).value;”> Basically, when the date is changed, the date should be added […]

How can I do this trick with css and/or javascript?

This is the code: HTML: <img src=”…” /> // other stuff <div id=”image”> <a href=”” > bla bla bla </a> <a href=”” > ble ble ble </a> </div> CSS: #image a:hover{color:green;} I want this: When the user put mouse over the image, then all the links in the div with id “image” become green ( […]

How to add simple dom-element into ExtJS container?

I want to add Canvas element into ExtJS Container element. But it accepts only Ext.Component, not any dom element. Canvas create code: canvas = document.createElement(‘canvas’); How to insert it into container, or I need to use another ext component? I need to have some resize logic for component, container have it.

Is it possible to do mash-ups in FirefoxOS?

I have just started doing research, but I assume that other people might have the same question: Is it possible to read data from different sources for a FirefoxOS application, such as reading from RSS feeds from different domains? Are you constrained by same-origin policy or is there a way to bypass it?