‏إظهار الرسائل ذات التسميات between. إظهار كافة الرسائل
‏إظهار الرسائل ذات التسميات between. إظهار كافة الرسائل

الثلاثاء، 24 ديسمبر 2013

How to replace text between two XML tags using jQuery or JavaScript?

I have a XML mark-up/code like the following. I want to replace the text inside one of the tags (in this case ...) using JavaScript or jQuery.

A new beginning Stuff here...

The source is inside a textarea. I have the following code, but it is obviously not doing what I want.

code=$("xml-code").val(); // content of XML sourcenewBegin = "The same old beginning"; // new text inside tagsnewBegin = ""+newBegin +""; code=code.replace("",newBegin); // replace content

This is just appending to the existing text inside the begin tags. I have a feeling this can be done only using Regex, but unfortunately I have no idea how to do it.


View the original article here

الجمعة، 20 ديسمبر 2013

Different CSS output between less compilers

For a while, I used to compile my less using Sublime's less2css plugin, but more recently I've started using LiveReload* and I love it.

I noticed a difference between the CSS output depending on the compiler I used.


For the following LESS:

.gallery { margin-bottom: 1em; img { .wide-gallery& { width: 49%; &:nth-child(odd) { margin-right: 2%; } } }}


LiveReload gave me the output I expected:

.gallery { margin-bottom: 1em;}.wide-gallery.gallery img { width: 49%;}.wide-gallery.gallery img:nth-child(odd) { margin-right: 2%;}


...but my less2css plugin in sublime mismatched my selectors:

.gallery { margin-bottom: 1em;}.wide-gallery .gallery img { width: 49%;}.wide-gallery .gallery img :nth-child(odd) { margin-right: 2%;}

Are the two compilers just using a different version of less? I'm not sure what's going on here.


*I'm using LiveReload v0.7.1.0 on Windows 8.


View the original article here