Enumerate CSS style elements using JavaScript

First up, JavaScript is definitely not my native tongue. Nevertheless, I’ve been tasked with creating a web page where the user can use a colour picker to change CSS elements. These then need to be sent back to the server to be stored in a database. It’s all working so far except the last part, […]

How to remove br using jquery?

My structure is like this: <p>something</p> <br/> <br/> <p>ssddfgdfg</p> <br/> <br/> <p>dsdfsfsdfsdfsd</p> <br/> <br/> I want to remove one br tag whenever 2 br tag comes together, like this: <p>something</p> <br/> <p>ssddfgdfg</p> <br/> <p>dsdfsfsdfsdfsd</p> <br/> How can I achieve this using jQuery?

why this is output as the following?

var obj = [ “one”, “two”, “three”]; $.each(obj, function() { console.log(this); }); The output I get is { ‘0’: ‘o’, ‘1’: ‘n’, ‘2’: ‘e’ } { ‘0’: ‘t’, ‘1’: ‘w’, ‘2’: ‘o’ } { ‘0’: ‘t’, ‘1’: ‘h’, ‘2’: ‘r’, ‘3’: ‘e’, ‘4’: ‘e’ } I suppose to get “one” “two” “three”, but I get […]

How to stop javascript ajax requests in inactive Iframe?

I have made Website, where various other pages are built-in as “apps” with i frames: <iframe id=”frame1″ src=”./app1.php”> <iframe id=”frame2″ src=”./app2.php”> In these apps, there is javascript code executed, among others very high-frequent HTTP-Requests. $(‘#app1button’).click(function () { //Here i have to stop the HTTP-Requests which where fired from the JS of App2 hideAllApps(); showApp(app1); }); […]

Improving my file i/o algorithm

For a given set of text files, I need to find every “\” character and replace it with “\\“. This is a Windows system, and my scripting language options are Javascript, VBScript, or Perl. These files are largish (~10MB a piece), and there are a good number of them (~15,000). I’ve already come up with […]

Uncheck Checkboxes on Mozilla Refresh

I’ve noticed that Mozilla’s refresh doesn’t bring the page to a blank slate. I have checkboxes on the form that I need to be unchecked when the page is loaded/refreshed. Currently I am using this: <body onLoad=”uncheck()”> function uncheck() { // Uncheck all checkboxes on page load $(“input:checkbox:checked”).attr(“checked”, “”); console.log(“uncheck”); } This works for loading […]

How to Remove dynamic Parent <tr> via OnClick of child <input>

I’m adding the <tr> via a javascript var: var txtBox = “<tr id=’dynTR’><td><input type=’text’ class=’textBoxes’ /></td><td><input type=’text’ class=’textBoxes’ value=’0′ /></td><td><input type=’button’ value=’-‘ /></td></tr>”; With my function being: function AddTR(table) { $(table).append(txtBox); } My table structure (along with the button for the function) in the HTML being: <table id=”tblTest” class=”testTable”> <thead> <tr> <td>Product</td> <td>Quantity</td> <td>Remove TR</td> […]

JQuery: how to select parent table for parsing

I have JS function which parses through a table: // id contains a message id, activeRow is “this” from onClick on tr function doSomething ( id, activeRow ) { // AJAX calling using id as parameter $(“#searchResultTable > tbody > tr”).each(function(index) { $(this).removeClass(“bold”); }); } This works perfectly fine (thanks to Ariel @ other post), […]

Passing store through context with <Provider> not working in connect() based scenario

Edit: Summary – the initial cause of my question was actually a typo: it wasn’t working due to a capital ‘G’. However, the kind answerers addressed not only the typo, but the wrong premise in the approach I was taking – if you too are passing store using Provider and using connect, their answers are […]

JCrop resizing the image not cropping – Javascript

I am trying to use JCrop to crop an image. However the results are frustratingly wrong and I am not sure why. I have an image uploader that when someone selects in image a javascript changes the source of an image already on the page to match the newly upload image. I then have this […]