javascript

Undue Br tag Is adding In Table Html

I have a user interface where I'm toggling between HTML markup view and rendered view. An HTML Editor. Using Javascript I have set that if anyone types any word and presses enter and then types another word then it should render as two lines. In HTML view this is an inserted <BR> tag as per my expectation. But when we insert a table wi...

JavaScript list of exceptions

Hi all, This time I don't have any problem but just for curiosity I want to know how many exception are there in JavaScript. For example I am using following code: <script type="text/javascript"> var x; try{ x = 1 / 0; alert(x); // output: Infinity. FYI: JavaScript has Infinity property and it's value is 1.7976...

how can I check the input is only number and white space in regular expression?

I have "222 22 222", "333 33 33 333", "1234/34", and "ab345 543" and I want to check whether these inputs are numeric and white space. I.E this case, the first and the second inputs should return True by using method Test of Regular Expression, or return its own value by using Exec method. The third and the fourth should return false. Ho...

wrong syntax in IE? - ajax & Js

Hi, i have a code line like this: (JS) numOfprocess = parseInt(xmlDoc.getElementsByTagName('process_count')[0].childNodes[0].nodeValue) for (i = 1; i <= numOfProcess; i++) { processStatus = xmlDoc.getElementsByTagName('proccess' + i)[0]; if(processStatus.childNodes[0].nodeValue == false) {...} } everytime i use this syntax there is an...

Form not submitted after a second call

I try to submit a form if a condition is not validated. <form action="http://www.google.com" method="post" id="support_form"> <p class="accept"><input type="checkbox" id="id_cgu" name="cgu" value="1"> I accept <input type="submit" value="ok"> </form> <script language="javascript"> $("#support_form").submit(function() { if($("#...

Removing a DOM element using jQuery not working

Hi guys, I'll get straight to the point, I am using jQuery to clone a div element, which has a span within it to which I have binded a click event that when triggered removes the just cloned section from the DOM, now the first section works ok, but for some reason it won't remove the cloned sections once they are created, here is my code...

Can't keep custom attributes in DOM?

A very simple asp.net webform page. <asp:DronDownList id="ddl" runat="server"> <asp:Button id="btn" runat="server" Text="Do nothing but post back" /> In Page_Load: if (!IsPostBack) { ListItem item = new ListItem("text1","value1"); item.Attributes["custom"] = "CustomValue"; ddl.Items.Add(item); } The html it renders:(which ...

is there any way to make my jquery search better ?

Hello var myarr= Array('test1','test2','test3'); var searchTerm = "test"; var rSearchTerm = new RegExp( searchTerm,'i'); $.each(myarr, function(i) { if (myarr[i].match(rSearchTerm)) { //item found } });​ guys is there any way to make my search algorithm better ? "myarr" will be a big array so i want...

How do I retrieve all text in an HTML DOM but exclude SCRIPT and STYLE tags?

I know how to quickly extract text nodes from a DOM: document.evaluate('//text()', document, null, XPathResult.ANY_TYPE, null) But is there an easy way to exclude text from SCRIPT, STYLE, or other tags that are not shown to the user? Something like: '//text()[ parent.name not in ("SCRIPT", "STYLE") ]' Thanks, Mike ...

How to alternate moveStart in Firefox?

Does anybody know how to use range.setStart in the same way as range.moveStart works in IE? I'd like to implement backspace/delete in JS, something like this: range.moveStart('character',-1); range.deleteContents(); but in Firefox ...

problem with capturing xml response from webservice and appending it to div tags

This is my code on html page which references to webservice which is in local application folder. Can anyone help to resolve this issue var keyword2 = "{\"keyword1\":\"" + keyword1 + "\",\"streetname\":\"" + address1 + "\",\"lat\":\"" + lat + "\",\"lng\":\"" + lng + "\",\"radius\":\"" + radius + "\"}"; $.ajax({ ...

How to block if JS download is not completed

I am downloading the JS file asynchronously by appending the JS file to HTML head. Now in html body, before using the JS file, I want to check if JS file has downloaded and is present in the cache. If the JS file is NOT present in the cache(e.g: in case of slow internet connnections), I want to block until it is downloaded. In other word...

Avoid page flickering when updating a YUI DataTable

I am using jlinq a library for extending linq to json and hence i filter my json data. Consider i have a json data that draws a yui datatable on page load with 100 rows. I am doing a clientside filter which will reduce my json data and i am now redrawing the same datatable. What happens is it works pretty well but with an annoying flicke...

Javascript seems to be moving form text down about 5 pixels

Hello, I am using a form entry field that seems to be effected by some Javascript that I am using on it. For whatever reason, the text entered into the field is about 5 pixels too low. These seems to be happening because of the Javascript. The problem with the text being 5 pixels too low is that lower-case letters like "g", "j", etc....

setting a property that has only a getter js error

i have the following div structure with respective ids : <div id="border_1" class="track_mc01302 track_01_mc01302"> <img id="_img" /> <div id="border"></div> </div> but when i click on the parent div an error is encountered which says : setting a property that has only a getter i have written listener for keyboard press event...

How to select all values in drop down list by clicking a button using jQuery?

If I use this $("select option").attr("selected", "true"); Or $(function(){ $('select').children('option').attr('selected', 'selected'); }); the list of dropdown will be selected automatically. But in my position I should not use Iterator. Here both function using iterator. Here each and every option we set true or selected t...

Gson and the argonauts - problem converting javascript array, to json string, to java pojo using gson. Trying to get my structures correct

Here is my json string, that I am acessing in java: json = [ {"id":"123456","Data":"skill2","dmlcrud":false}, {"id":"123456","Data":"skill3","dmlcrud":true}, {"id":"123456","Data":"skill14","dmlcrud":true}, {"id":"123321","Data":"skill1","dmlcrud":false}, {"id":"123321","Data":"skill14","dmlcrud":false} ] I now wa...

prevent queued events from being executed in jquery

I have a handler which is triggered for two events: blur trigger of object A. click on object B. The problem is when Object A has focus and I click on B, both the events are triggered. I want to stop this from happening. The handler should be executed only once in this case because there's a toggle() inside which is being nullified d...

IE8 Javascript document.domain error

Hello. I need to change the domain of the document and then set it back again to the original value. It looks something like this [the page is on domain base.site.com]: function execute () { document.domain = "site.com"; // Access an object that is on another frame, but did the same set of the domain document.domain = "base.site.com...

tinyMCE JQuery plugin - How do you set global config options?

I'm new to tinyMCE and I like the jQuery plugin that comes in the latest version. However I'd like to set global options that would be used in every subsequent instance; for example themes and skins. Is this possible? Edit. Here is an example of the method I have used. $(document).ready(function(){ var config = { direction...